Hiding row on dropdown selected index change
<p>I am using an asp.net formsview in my asp.net page and updatepanel . It has two templates Insertemplate and EditTemplate. Indie both templates there is a dropdownlist with id ddlCountry. I have a dropdownlist with all countries. I am showing states dropdown, if country is US and want to hide the row where states dropdown is shown If country is Non US. I am using following code but it is not working:</p>

<pre><code>protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
    {

        Control c = (Control)sender;
        Control nc = c.NamingContainer;
        if (nc.ID == "fvBillTo" &amp;&amp; rblShipSelect.SelectedValue == "billing")
        {
            setShippingAndTaxesDisplay();

            DropDownList ddlCountry = c as DropDownList;
            if (ddlCountry.SelectedItem != null &amp;&amp; ddlCountry.SelectedItem.Value == "001")
            {
                HtmlGenericControl trState = nc.FindControl("trState") as HtmlGenericControl;
                trState.Visible = true;
            }
            else
            {
                HtmlGenericControl trState = nc.FindControl("trState") as HtmlGenericControl;
                trState.Visible = false; // code stops here
            }

        }
    }
</code></pre>
