title: how to bind ASP.Net DropDownList control in EditItemTemplate of GridView on edit(imagebutton)click
body: <p>I have requirement to bind ASP.Net DropDownList control in EditItemTemplate of GridView.
  I have a edit imagebutton with commandname="Edit"also dropdown needs to be binded from different table(directory) and not the table through which grid is binded(details).</p>
  
  <pre><code>if (e.Row.RowType == DataControlRowType.DataRow &amp;&amp; (e.Row.RowState &amp; DataControlRowState.Edit) == DataControlRowState.Edit &amp;&amp; GridView1.EditIndex == e.Row.RowIndex)
   {
      DropDownList DStatusEdit = (DropDownList)e.Row.FindControl("DStatusEdit");
      string query = "select distinct status from directory";
      SqlCommand cmd = new SqlCommand(query);
      DStatusEdit.DataSource = GetData(cmd);
      DStatusEdit.DataTextField = "status";
      DStatusEdit.DataValueField = "status"; DStatusEdit.DataBind();     
      DataStatusEdit.DataBind();
   }
  </code></pre>
  
  <p>the page is running but when i click edit image button the dropdwn shows but no data in dropdown binded it is empty.
  My gridview is inside update panel.
  How can i achieve this?
  Should dropdownlist in my case be binded inside rowcommand but how?</p>