UpdatePanel Question
<p>I have a dropdown menu bounded with values from the db on form load. I wanted to use the dropdown as a filter to update a datagrid using an updatepanel, which I managed to get working. I'm binding the datagrid in form load and on selected index changed as shown. I also want to use the same dropdown to update a formview using the DataValueField, which for some reason isn't working. Could the reason be that I'm using two different updatepanels and the same asynchpostbacktrigger? Where should I be binding data to the formview? Your input would be greatly appreciated! Thanks in advance...</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
       SqlConnection conn = new SqlConnection(GetConnectionString());
        conn.Open();

        SqlCommand cmd3 = new SqlCommand("SELECT c.Email As CompanyEmail, c.Telephone AS Telephone, m.Email AS AdminEmail, m.FirstName + ' ' + m.LastName AS CompanyAdmin FROM Company c, Member m WHERE m.CompanyID = c.CompanyID AND m.CompanyID = '" + company_id + "' AND m.CompanyRole = 'Admin'", conn);
        SqlCommand cmd = new SqlCommand("SELECT CompanyName, CompanyID FROM Company ORDER BY CompanyName", conn);
        SqlCommand cmd2 = new SqlCommand("SELECT p.ProjectName AS ProjectName, p.ProjectID, p.CompanyID, p.Status AS Status FROM Project p, Company c WHERE p.CompanyID = c.CompanyID AND c.CompanyID = '" + company_id + "' ORDER BY ProjectName", conn);

        cmd.CommandType = CommandType.Text;

        SqlDataAdapter da = new SqlDataAdapter(cmd);

        DataSet ds = new DataSet();

        da.Fill(ds);

        if (!Page.IsPostBack)
        {

            company_list.DataSource = ds;
            company_list.DataTextField = "CompanyName";
            company_list.DataValueField = "CompanyID";
            company_list.DataBind();

            company_list.Items.Insert(0, new System.Web.UI.WebControls.ListItem("-- Please Select Company --"));

        }
        //cmd2.Connection.Open();

                cmd2.CommandType = CommandType.Text;

                SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd2);
                DataSet ds2 = new DataSet();
                sqlAdapter.Fill(ds2);

                Gridview1.DataSource = ds2;
                Gridview1.DataBind();

                FormView1.DataSource = cmd3.ExecuteReader();
                FormView1.DataBind();

                conn.Close();

            //}
        //cmd2.Connection.Close();
        //cmd2.Connection.Dispose();
    }

}
protected void company_list_SelectedIndexChanged(object sender, EventArgs e)
{

    company_id = company_list.SelectedValue;

    SqlConnection conn = new SqlConnection(GetConnectionString());
    conn.Open();


    SqlCommand cmd2 = new SqlCommand("SELECT p.ProjectName AS ProjectName, p.ProjectID, p.CompanyID, p.Status AS Status FROM Project p, Company c WHERE p.CompanyID = c.CompanyID AND c.CompanyID = '" + company_id + "' ORDER BY ProjectName", conn);


        cmd2.CommandType = CommandType.Text;

        SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd2);
        DataSet ds2 = new DataSet();
        sqlAdapter.Fill(ds2);

        Gridview1.DataSource = ds2;
        Gridview1.DataBind();

        SqlCommand cmd = new SqlCommand("SELECT c.Email As CompanyEmail, c.Telephone AS Telephone, m.Email AS AdminEmail, m.FirstName + ' ' + m.LastName AS CompanyAdmin FROM Company c, Member m WHERE m.CompanyID = c.CompanyID AND m.CompanyID = '" + company_id + "' AND m.CompanyRole = 'Admin'", conn);
        cmd.CommandType = CommandType.Text;

        FormView1.DataSource = cmd.ExecuteReader();
        FormView1.DataBind();

        conn.Close();


}
</code></pre>

<p>ASP.NET:</p>

<pre><code>&lt;div style="float:left;"&gt;
                       &lt;table&gt;
                        &lt;tr&gt;
                            &lt;td class="style1"&gt;Select Company:&lt;/td&gt;
                            &lt;td&gt;&lt;asp:DropDownList ID="company_list" runat="server" 
                               onselectedindexchanged="company_list_SelectedIndexChanged" width="185" AutoPostBack="true" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td colspan="2" align="right"&gt;&amp;nbsp;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;/table&gt;

                         &lt;asp:UpdatePanel ID="UpdateInfo" runat="server"&gt;
                        &lt;ContentTemplate&gt;
                        &lt;asp:FormView ID="FormView1" runat="server"&gt;
                        &lt;ItemTemplate&gt;
                        &lt;table&gt;
                        &lt;tr&gt;
                            &lt;td&gt;Company Admin:&lt;/td&gt;
                            &lt;td&gt;&lt;asp:TextBox Text='&lt;%# Eval("Email") %&gt;' CssClass="input input1" ID="co_admin" width="150" runat="server" ReadOnly="True" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;Admin Email:&lt;/td&gt;
                            &lt;td&gt;&lt;asp:TextBox Text='&lt;%# Eval("AdminEmail") %&gt;' CssClass="input input1" ID="ad_email" width="150" runat="server" ReadOnly="True" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;Company Email:&lt;/td&gt;
                            &lt;td&gt;&lt;asp:TextBox Text='&lt;%# Eval("CompanyEmail") %&gt;' CssClass="input input1" ID="co_email" width="150" runat="server" ReadOnly="True" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;Telephone:&lt;/td&gt;
                            &lt;td&gt;&lt;asp:TextBox Text='&lt;%# Eval("Telephone") %&gt;' CssClass="input input1" ID="telephone" width="150" runat="server" ReadOnly="True" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;&lt;/td&gt;
                            &lt;td&gt;&lt;asp:Button CssClass="button_style" width="170" ID="export" Text="EXPORT TO EXCEL" runat="server" /&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;/table&gt;
                       &lt;/ItemTemplate&gt;
                       &lt;/asp:FormView&gt; 
                       &lt;/ContentTemplate&gt;
                       &lt;Triggers&gt;
                            &lt;asp:AsyncPostBackTrigger ControlID="company_list" /&gt;
                        &lt;/Triggers&gt;
                       &lt;/asp:UpdatePanel&gt;

                       &lt;/div&gt;

                       &lt;center&gt;


                            &lt;asp:UpdatePanel ID="UpdateGrid" runat="server"&gt;
                &lt;ContentTemplate&gt;
                           &lt;asp:gridview ID="Gridview1" runat="server" ShowFooter="True"
                       AutoGenerateColumns="False" GridLines="None"&gt;

                    &lt;Columns&gt;
                    &lt;asp:TemplateField HeaderText="Project Name"&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:TextBox Text='&lt;%# Eval("ProjectName") %&gt;' CssClass="input input1" ID="project_name" width="150" runat="server" ReadOnly="True"&gt;&lt;/asp:TextBox&gt;
                    &lt;/ItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;

                    &lt;asp:TemplateField HeaderText="Status"&gt;
                    &lt;ItemStyle Width="150" /&gt;
                    &lt;ItemTemplate&gt;
                        &lt;center&gt;&lt;asp:Image ImageUrl='&lt;%# GetStatusImage(Eval("Status").ToString()) %&gt;' ID="status" runat="server"/&gt;&lt;/center&gt;
                    &lt;/ItemTemplate&gt;
               &lt;/ContentTemplate&gt;
                &lt;Triggers&gt;
                    &lt;asp:AsyncPostBackTrigger ControlID="company_list" /&gt;
                &lt;/Triggers&gt;
                &lt;/asp:UpdatePanel&gt;
</code></pre>
