title: Asp.net Detailview not updating in realtime
body: <p>When I add a product category and the detailview will not update by itself. Is there anyway that I can do that?</p>
  
  <p><a href="https://i.stack.imgur.com/Fv5Dz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fv5Dz.png" alt="Product Category"></a></p>
  
  <p><a href="https://i.stack.imgur.com/xQVg8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xQVg8.png" alt="detailview"></a></p>
  
  <p>This is the code of adding category</p>
  
  <pre><code>    &lt;div class="container "style="background-color:lavender"&gt;
          &lt;h2&gt;Product Category &lt;/h2&gt;
  &lt;asp:DetailsView ID="DetailsViewCategory" runat="server" AutoGenerateRows="False" CellPadding="4" DataKeyNames="CategoryId" DataSourceID="SqlDataSourceCategory" DefaultMode="Insert" Height="83px" Width="360px" ForeColor="#333333" GridLines="None"&gt;
      &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
      &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
      &lt;EditRowStyle BackColor="#999999" /&gt;
      &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /&gt;
      &lt;Fields&gt;
          &lt;asp:BoundField DataField="CategoryId" HeaderText="CategoryId" InsertVisible="False" ReadOnly="True" SortExpression="CategoryId" /&gt;
          &lt;asp:BoundField DataField="CategoryName" HeaderText="Category Name" SortExpression="CategoryName" /&gt;
          &lt;asp:CommandField CancelText="" ShowInsertButton="True" /&gt;
      &lt;/Fields&gt;
      &lt;FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" /&gt;
      &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle ForeColor="White" HorizontalAlign="Center" BackColor="#284775" /&gt;
      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
  &lt;/asp:DetailsView&gt;
  &lt;br /&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>and this is the code of my detail view</p>
  
  <pre><code>&lt;asp:DetailsView ID="DetailsViewProduct" runat="server" AutoGenerateRows="False" DataKeyNames="ProductId" DataSourceID="SqlDataSourceProduct" DefaultMode="Insert" Height="16px" Width="46%" OnItemInserted="InsertProduct" HorizontalAlign="Center"&gt;
      &lt;Fields&gt;
          &lt;asp:TemplateField HeaderText="Picture"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:FileUpload ID="FileUploadPicture" runat="server" Height="22px" Width="400px" CssClass="center-block" ForeColor="Black"/&gt;
              &lt;/InsertItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Image ID="Image1" runat="server" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="ProductId" HeaderText="ProductId" SortExpression="ProductId" InsertVisible="False" ReadOnly="True" /&gt;
          &lt;asp:BoundField DataField="ProductName" HeaderText="Name" SortExpression="ProductName"/&gt;
          &lt;asp:TemplateField HeaderText="Description" SortExpression="ProductDescription"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# Bind("ProductDescription") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox2" runat="server" Height="42px" Text='&lt;%# Bind("ProductDescription") %&gt;' TextMode="MultiLine" Width="400px" CssClass="center-block"&gt;&lt;/asp:TextBox&gt;
              &lt;/InsertItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("ProductDescription") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Category" SortExpression="ProductCategory"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox3" runat="server" Text='&lt;%# Bind("ProductCategory") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:SqlDataSource ID="SqlDataSourcePC" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DefaultConnection %&gt;" SelectCommand="SELECT * FROM [ProductCategory]"&gt;&lt;/asp:SqlDataSource&gt;
                  &lt;asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="SqlDataSourcePC" DataTextField="CategoryName" DataValueField="CategoryId" Height="18px" SelectedValue='&lt;%# Bind("ProductCategory") %&gt;' Width="400px" CssClass="center-block"&gt;
                  &lt;/asp:DropDownList&gt;
              &lt;/InsertItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("ProductCategory") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField HeaderText="Brand" SortExpression="ProductBrand"&gt;
              &lt;EditItemTemplate&gt;
                  &lt;asp:TextBox ID="TextBox4" runat="server" Text='&lt;%# Bind("ProductBrand") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;/EditItemTemplate&gt;
              &lt;InsertItemTemplate&gt;
                  &lt;asp:SqlDataSource ID="SqlDataSourceBrand1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DefaultConnection %&gt;" SelectCommand="SELECT * FROM [ProductBrand]"&gt;&lt;/asp:SqlDataSource&gt;
                  &lt;asp:DropDownList ID="DropDownList6" runat="server" DataSourceID="SqlDataSourceBrand1" DataTextField="ProductBrand" DataValueField="BrandId" SelectedValue='&lt;%# Bind("ProductBrand") %&gt;' Width="400px" CssClass="center-block"&gt;
                  &lt;/asp:DropDownList&gt;
              &lt;/InsertItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Bind("ProductBrand") %&gt;'&gt;&lt;/asp:Label&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="ProductPrice" HeaderText="Price (RM)" SortExpression="ProductPrice" /&gt;
          &lt;asp:BoundField DataField="ProductQty" HeaderText="Stock Quantity" SortExpression="ProductQty" /&gt;
          &lt;asp:CommandField CancelText="" ShowInsertButton="True" /&gt;
      &lt;/Fields&gt;
  &lt;/asp:DetailsView&gt;
  </code></pre>