How to let this DropDownList (filter) works again with this GridView?
<p>I am developing an intranet web application which works as a Suggstions Box. The Admin will see a list of all submitted suggestions in a GridView and he has the ability to accept or reject these suggestions through the DropDownList that is added to the GridView. Besides that, there is a DropDownList at the top of this GridView to filter the suggestions based on the Division of the user who submitted one of these suggestions.</p>

<p>In addition, under this GridView, there is another GridView that shows the suggestions with their status as Accepted or Rejected. This GridView will be refreshed immediately after each time the admin accepts or rejects one of the suggestions. Also, the Admin has the ability to print this GridView.</p>

<p>Everything was working fine before adding the second GridView inside the UpdatePanel control, <strong>but now the filter for filtering the suggestions in the first GridView is not working. Any idea? Any help please?</strong></p>

<p>My ASP.NET Code:</p>

<pre><code>&lt;strong&gt; Division &lt;/strong&gt;
    &lt;asp:DropDownList ID="ddlDivision" runat="server" AppendDataBoundItems="True" 
        AutoPostBack="True" DataSourceID="sqlDataSourceDivision" DataTextField="DivisionShortcut" 
        DataValueField="DivisionShortcut"  
        Width="175px" EnableViewState="False"&gt;
        &lt;asp:ListItem Value="%"&gt;All&lt;/asp:ListItem&gt;
    &lt;/asp:DropDownList&gt;


    &lt;br /&gt;  &lt;br /&gt;  

        &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;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; 
    &lt;Triggers&gt;
        &lt;asp:AsyncPostBackTrigger ControlID="ddlDivision" EventName="SelectedIndexChanged" /&gt;
    &lt;/Triggers&gt;
    &lt;ContentTemplate&gt;
            &lt;br /&gt;

                &lt;p&gt;&lt;h3&gt;&lt;b&gt;&lt;u&gt;PMOD Divisions' Safety Suggestions List&lt;/u&gt;&lt;/b&gt;&lt;/h3&gt;
                    &lt;p&gt;
                    &lt;/p&gt;
                    &lt;br /&gt;
                    &lt;asp:Panel ID="Panel1" runat="server"&gt;
                        &lt;asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
                            AlternatingRowStyle-CssClass="alt" AutoGenerateColumns="False" CssClass="mGrid" 
                            DataSourceID="SqlDataSource4" RowStyle-HorizontalAlign="Center"&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="Month Submitted" 
                                    ReadOnly="True" SortExpression="SubmittedMonth" /&gt;
                                &lt;asp:BoundField DataField="DivisionShortcut" HeaderText="Division" 
                                    SortExpression="DivisionShortcut" /&gt;
                                &lt;asp:BoundField DataField="Username" HeaderText="NetworkID" 
                                    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;/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" OnClick="btnPrint_Click" 
                        Text="Print" /&gt;
                    &lt;p&gt;
                    &lt;/p&gt;
            &lt;/p&gt;    


       &lt;/ContentTemplate&gt;
    &lt;/asp:UpdatePanel&gt;
</code></pre>

<p>Code-Behind:</p>

<pre><code>protected void btnPrint_Click(object sender, EventArgs e)
    {
        Session["ctrl"] = Panel1;
        ScriptManager.RegisterStartupScript(GridView2, GridView2.GetType(), "onclick", "window.open('Print.aspx','PrintMe','height=400px,width=800px,scrollbars=1');", true);
    }

    int i = 1;
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[0].Text = i.ToString();
            i++;

        }
    }


    protected void DropDownList_DataBound(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ((DropDownList)sender).Items.Insert(0, new ListItem("--Select--", ""));
        }
    }

    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();
        }

        GridView2.DataBind();

    }
</code></pre>
