Avoid refreshing of Gridview when a dropdown placed in it fires a trigger - C#
<p>I am dynamically creating a dropdownlist and a textbox inside a gridview. The textbox is currently diabled. The IDs of both these controls are being fetched from an SQL table (so they are also dynamic in nature as the values received from SQL might change). </p>

<p>I want the text box to be enabled only if "Other" is selected in newly generated dropdownlist. Below is the code for dropdownlist that I am generating:</p>

<pre><code>protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    e.Row.Cells[0].Visible = false;
    e.Row.Cells[1].Width = 400;
    e.Row.Cells[2].Visible = false;
    e.Row.Cells[3].Visible = false;
    e.Row.Cells[4].Visible = false;
    e.Row.Cells[5].Width = 300;
    e.Row.Cells[6].Visible = false;
    e.Row.Cells[7].Visible = false;
    e.Row.Cells[8].Visible = false;
    e.Row.Cells[9].Width = 300;
    string anstype = e.Row.Cells[2].Text;
    string ansname = e.Row.Cells[3].Text;
    string othertype = e.Row.Cells[6].Text;
    string othername = e.Row.Cells[7].Text;

    if (anstype == "DropDownList")
    {
        DropDownList ddl = new DropDownList();
        ddl.ID = ansname;
        ddl.AutoPostBack = true;
        ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
        ddl.Width = 300;
        e.Row.Cells[5].Controls.Add(ddl);
    }

    if (othertype == "Free Text")
    {
        TextBox txt = new TextBox();
        txt.ID = othername;
        txt.Width = 300;
        txt.Enabled = false;
        e.Row.Cells[9].Controls.Add(txt);
    }

protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
    DropDownList ddlName = new DropDownList();
    ddlName = (DropDownList)sender;
    string val = ddlName.SelectedItem.Text.ToString();
    if (val == "Other")
    {
        //ENABLE THE TEXT BOX
    }
}
</code></pre>

<p>The simplest approach that I can think of is to pass the name of textbox (othename variable) to the eventhandler. Though being an noob with C#, I am not sure how to do it. PLEASE HELP..!!!</p>

<blockquote>
  <p><strong>!!..EDIT..!!</strong></p>
</blockquote>

<p>I figured out the way to refer the text but now theres another issue that I am facing. Because of the "AutoPostBack", the whole GridView get refreshed and the even for the dropdownlist doesn't get triggered. Any suggestions?</p>
