title: DataBinding DropDownList inside GridView EditItemTemplate
body: <p>I have a Gridview which populates data witht a Dataset.
  I also have a DropDownlist which is a an <code>EditTemplate</code> of a <code>TemplateField</code>.
  I want to bind it to the dataset so that it can populate data from it.I searched it but it doesn't seem to work.I'm new to this. If not the code,Some help me to get hands on a good tutorial.</p>
  
  <p>Heres my code snippet:</p>
  
  <p>`   </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (Page.IsPostBack == false) {
          BindGrid();
  
      }
  }
  private void BindGrid() { 
      //Get dataset
      //bind
  
      DataSet ds = new DataSet("Employees");
      SqlConnection con = new SqlConnection("Password=admin;User ID=admin;Initial Catalog=asptest;Data Source=dbsvr");
      SqlDataAdapter da = new SqlDataAdapter("select * from employees", con);
  
      da.Fill(ds);
      gvEmp.DataSource = ds;
      gvEmp.DataBind();    
  }
  
  
  protected void gvEmp_RowEditing(object sender, GridViewEditEventArgs e)
  {
      gvEmp.EditIndex = e.NewEditIndex;
      BindGrid();
      BindDropDown();        
  }
  
  private void BindDropDown() {
      //DataSet ds = new DataSet("Employees");
      //SqlConnection con = new SqlConnection("Password=priyal;User ID=priyal;Initial Catalog=asptest;Data Source=dbsvr");
      //SqlDataAdapter da = new SqlDataAdapter("select deptno from employees", con);
  
      //da.Fill(ds);
      //gvEmp.DataSource = ds;
      //gvEmp.FindControl("ddlDept").DataBind();
  
  
  
  
  }
  protected void gvEmp_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
  {
      //this means that no index is selected
      gvEmp.EditIndex = -1;
  }`
  </code></pre>
  
  <p>The commented code is what I tried.</p>
  
  <p>Thanks</p>