title: How to get a refreshed table without refreshing the whole page?
body: <p>I am developing an ASP.NET intranet web application which is a Quiz Engine. Since I am a new ASP.NET developer, I have a table that shows some feedback received from the users and the admin has the ability to accept or reject these feedback using the DropDownList.</p>
  
  <p>Under this table, there is a JQuery Accordion that when the Admin clicks on it, he will see a table with the received feedback for the last three months. But when the admin accepts or rejects one of the feedback and then clicks on the Accordion, he will see the that table but without that feedback even if the feedback is one of the feedbacks submitted last month. However, when you refresh the page and then clicks on the Accordion, he will see it. </p>
  
  <p><strong>So is there any functionality that will help me to get an auto-refresh table with refreshing the whole page?
  Any help please?</strong></p>
  
  <p>ASP.NET Code:</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                          AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                          width="950px" CssClass="mGrid"
                          AlternatingRowStyle-CssClass="alt" 
                          RowStyle-HorizontalAlign="Center" 
                          DataSourceID="SqlDataSource1" 
                          OnRowDataBound="GridView1_RowDataBound" &gt;
              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
              &lt;HeaderStyle Font-Bold = "true" ForeColor="Black" Height="20px"/&gt; 
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                      ReadOnly="True" SortExpression="ID" /&gt;
                  &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt;
                  &lt;asp:BoundField DataField="Description" HeaderText="Description" 
                      SortExpression="Description" /&gt;
                  &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /&gt;
                  &lt;asp:BoundField DataField="Username" HeaderText="Username" 
                      SortExpression="Username" /&gt;
                  &lt;asp:BoundField DataField="DivisionShortcut" HeaderText="Division" 
                      SortExpression="DivisionShortcut" /&gt;
                  &lt;asp:TemplateField HeaderText="Status"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:DropDownList ID="DropDownList" runat="server" DataSourceID="SqlDataSource2"
                                            Font-Bold="True" ForeColor="#006666" AppendDataBoundItems="false" 
                                            DataTextField="Status" DataValueField="ID" AutoPostBack="true" 
                                            OnDataBound="DropDownList_DataBound" OnSelectedIndexChanged ="DropDownList_SelectedIndexChanged"&gt;
                          &lt;/asp:DropDownList&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
          &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
              ConnectionString="&lt;%$ ConnectionStrings:testConnectionString %&gt;" 
              SelectCommand="SELECT     dbo.SafetySuggestionsLog.ID, dbo.SafetySuggestionsLog.Title, dbo.SafetySuggestionsLog.Description, dbo.employee.Name, dbo.SafetySuggestionsLog.Username, 
                        dbo.Divisions.DivisionShortcut
  FROM         dbo.employee INNER JOIN
                        dbo.SafetySuggestionsLog ON dbo.employee.Username = dbo.SafetySuggestionsLog.Username INNER JOIN
                        dbo.Divisions ON dbo.employee.DivisionCode = dbo.Divisions.SapCode"
                        FilterExpression="[DivisionShortcut] like '{0}%'"&gt;
  
                        &lt;FilterParameters&gt;
                          &lt;asp:ControlParameter ControlID="ddlDivision" Name="DivisionShortcut" 
                                                   PropertyName="SelectedValue" Type="String" /&gt;
                      &lt;/FilterParameters&gt;
          &lt;/asp:SqlDataSource&gt;
  
          &lt;%--For the DropDownList--%&gt;
          &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server"
                              ConnectionString="&lt;%$ ConnectionStrings:testConnectionString %&gt;" 
                              SelectCommand="SELECT * FROM [SafetySuggestionsStatus]"&gt;
          &lt;/asp:SqlDataSource&gt;
  
          &lt;%--Filtering by Division--%&gt;
          &lt;asp:SqlDataSource ID="sqlDataSourceDivision" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:testConnectionString %&gt;" 
          SelectCommand="SELECT [DivisionShortcut] FROM [Divisions]"&gt;&lt;/asp:SqlDataSource&gt;
  
  &lt;dl id="jfaq"&gt;
              &lt;br /&gt;
                  &lt;dt&gt;Safety Suggestions List (for the last three months)&lt;/dt&gt;
                      &lt;dd&gt; 
                          &lt;br /&gt;
                          &lt;asp:Panel ID="Panel1" runat="server"&gt;
                          &lt;asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                        AllowSorting="True" CssClass="mGrid"
                                        AlternatingRowStyle-CssClass="alt" 
                                        RowStyle-HorizontalAlign="Center" 
                                        DataSourceID="SqlDataSource4"&gt;
                              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                              &lt;HeaderStyle Font-Bold = "true" ForeColor="Black" Height="20px"/&gt; 
                              &lt;Columns&gt;
                                  &lt;asp:BoundField DataField="SubmittedMonth" HeaderText="Submitted Month" 
                                      SortExpression="SubmittedMonth" ReadOnly="True" /&gt;
                                  &lt;asp:BoundField DataField="DivisionShortcut" HeaderText="Division" 
                                      SortExpression="DivisionShortcut" /&gt;
                                  &lt;asp:BoundField DataField="Username" HeaderText="Username" 
                                      SortExpression="Username" /&gt;
                                  &lt;asp:BoundField DataField="Name" HeaderText="Name" 
                                      SortExpression="Name" /&gt;
                                  &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt;
                                  &lt;asp:BoundField DataField="Description" HeaderText="Description" 
                                      SortExpression="Description" /&gt;
                                  &lt;asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /&gt;
                                  &lt;asp:BoundField DataField="Status" HeaderText="Status" 
                                      SortExpression="Status" /&gt;
                              &lt;/Columns&gt;
                                  &lt;RowStyle HorizontalAlign="Center"&gt;&lt;/RowStyle&gt;
                          &lt;/asp:GridView&gt;
                          &lt;/asp:Panel&gt;
                          &lt;asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                              ConnectionString="&lt;%$ ConnectionStrings:testConnectionString %&gt;" SelectCommand="SELECT     TOP (100) PERCENT LEFT(DATENAME(month, dbo.SafetySuggestionsLog.DateSubmitted), 3) + '-' + DATENAME(year, dbo.SafetySuggestionsLog.DateSubmitted) 
                        AS SubmittedMonth, dbo.Divisions.DivisionShortcut, dbo.SafetySuggestionsLog.Username, dbo.employee.Name, dbo.SafetySuggestionsLog.Title, 
                        dbo.SafetySuggestionsLog.Description, dbo.SafetySuggestionsType.Type, dbo.SafetySuggestionsStatus.Status
  FROM         dbo.Divisions INNER JOIN
                        dbo.employee ON dbo.Divisions.SapCode = dbo.employee.DivisionCode INNER JOIN
                        dbo.SafetySuggestionsLog ON dbo.employee.Username = dbo.SafetySuggestionsLog.Username INNER JOIN
                        dbo.SafetySuggestionsType ON dbo.SafetySuggestionsLog.TypeID = dbo.SafetySuggestionsType.ID INNER JOIN
                        dbo.SafetySuggestionsStatus ON dbo.SafetySuggestionsLog.StatusID = dbo.SafetySuggestionsStatus.ID
  WHERE     (DATEDIFF(month, dbo.SafetySuggestionsLog.DateSubmitted, GETDATE()) &amp;lt; 3)
  ORDER BY dbo.SafetySuggestionsLog.DateSubmitted DESC"&gt;
                         &lt;/asp:SqlDataSource&gt;
  
                         &lt;asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_Click" /&gt;
                         &lt;/dd&gt;
                   &lt;/dl&gt;
  </code></pre>
  
  <p>Code-Behind:</p>
  
  <pre><code>protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
      {
          DropDownList ddl = (DropDownList)sender;
          int suggestionStatus = int.Parse(ddl.SelectedValue);
          GridViewRow row = (GridViewRow)ddl.NamingContainer;
          string strID = GridView1.DataKeys[row.RowIndex]["ID"].ToString();
          int ID = Int32.Parse(strID);
          //For inserting the status in the database
          string connString = "Data Source=localhost\\sqlexpress;Initial Catalog=psspdbTest;Integrated Security=True";
          string updateCommand = "UPDATE SafetySuggestionsLog  SET [StatusID] = @StatusID WHERE [ID] = @ID";
          using (SqlConnection conn = new SqlConnection(connString))
          {
              conn.Open();
              using (SqlCommand cmd = new SqlCommand(updateCommand, conn))
              {
                  cmd.Parameters.Clear();
                  cmd.Parameters.AddWithValue("@StatusID", suggestionStatus);
                  cmd.Parameters.AddWithValue("@ID", ID);
                  cmd.ExecuteNonQuery();
              }
              conn.Close();
          }
  
      }
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  I used the UpdatePanel control to get a partial update, and I used <code>&lt;triggers&gt;</code>, but I got the following error and I don't know why:</p>
  
  <blockquote>
    <p>Could not find an event named 'Click' on associated control
    'GridView2' for the trigger in UpdatePanel 'UpdatePanel1'.</p>
  </blockquote>
  
  <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; 
      &lt;Triggers&gt;
          &lt;asp:AsyncPostBackTrigger ControlID="GridView2" EventName="Click" /&gt;
      &lt;/Triggers&gt;
      &lt;ContentTemplate&gt;
         &lt;dl id="jfaq"&gt;
              &lt;br /&gt;
                  &lt;dt&gt;Safety Suggestions List (for the last three months)&lt;/dt&gt;
                      &lt;dd&gt; 
                          &lt;br /&gt;
                          &lt;asp:Panel ID="Panel1" runat="server"&gt;
                          &lt;asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                        AllowSorting="True" CssClass="mGrid"
                                        AlternatingRowStyle-CssClass="alt" 
                                        RowStyle-HorizontalAlign="Center" 
                                        DataSourceID="SqlDataSource4"&gt;
                              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                              &lt;HeaderStyle Font-Bold = "true" ForeColor="Black" Height="20px"/&gt; 
                              &lt;Columns&gt;
                                  &lt;asp:BoundField DataField="SubmittedMonth" HeaderText="Submitted Month" 
                                      SortExpression="SubmittedMonth" ReadOnly="True" /&gt;
                                  &lt;asp:BoundField DataField="DivisionShortcut" HeaderText="Division" 
                                      SortExpression="DivisionShortcut" /&gt;
                                  &lt;asp:BoundField DataField="Username" HeaderText="Username" 
                                      SortExpression="Username" /&gt;
                                  &lt;asp:BoundField DataField="Name" HeaderText="Name" 
                                      SortExpression="Name" /&gt;
                                  &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt;
                                  &lt;asp:BoundField DataField="Description" HeaderText="Description" 
                                      SortExpression="Description" /&gt;
                                  &lt;asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /&gt;
                                  &lt;asp:BoundField DataField="Status" HeaderText="Status" 
                                      SortExpression="Status" /&gt;
                              &lt;/Columns&gt;
                                  &lt;RowStyle HorizontalAlign="Center"&gt;&lt;/RowStyle&gt;
                          &lt;/asp:GridView&gt;
                          &lt;/asp:Panel&gt;
                          &lt;asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                              ConnectionString="&lt;%$ ConnectionStrings:testConnectionString %&gt;" SelectCommand="SELECT     TOP (100) PERCENT LEFT(DATENAME(month, dbo.SafetySuggestionsLog.DateSubmitted), 3) + '-' + DATENAME(year, dbo.SafetySuggestionsLog.DateSubmitted) 
                        AS SubmittedMonth, dbo.Divisions.DivisionShortcut, dbo.SafetySuggestionsLog.Username, dbo.employee.Name, dbo.SafetySuggestionsLog.Title, 
                        dbo.SafetySuggestionsLog.Description, dbo.SafetySuggestionsType.Type, dbo.SafetySuggestionsStatus.Status
  FROM         dbo.Divisions INNER JOIN
                        dbo.employee ON dbo.Divisions.SapCode = dbo.employee.DivisionCode INNER JOIN
                        dbo.SafetySuggestionsLog ON dbo.employee.Username = dbo.SafetySuggestionsLog.Username INNER JOIN
                        dbo.SafetySuggestionsType ON dbo.SafetySuggestionsLog.TypeID = dbo.SafetySuggestionsType.ID INNER JOIN
                        dbo.SafetySuggestionsStatus ON dbo.SafetySuggestionsLog.StatusID = dbo.SafetySuggestionsStatus.ID
  WHERE     (DATEDIFF(month, dbo.SafetySuggestionsLog.DateSubmitted, GETDATE()) &amp;lt; 3)
  ORDER BY dbo.SafetySuggestionsLog.DateSubmitted DESC"&gt;
                         &lt;/asp:SqlDataSource&gt;
  
                         &lt;asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_Click" /&gt;
                         &lt;/dd&gt;
                   &lt;/dl&gt;
  
         &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  </code></pre>