title: how to bind drop down list at edit item template Edit mode occurs in grid view
body: <p>i just want to bind two drop down list dynamically when grid view in row editing mode. here i declares one code block that dynamically fetches that row state and binds up those two drop down list.</p>
  
  <p>here is code :</p>
  
  <pre><code>  protected void GV_ViewCustomers_RowDataBound(object sender, GridViewRowEventArgs e)
      {
            ...............
      if (e.Row.RowType == DataControlRowType.DataRow &amp;&amp; (e.Row.RowState &amp; DataControlRowState.Edit) == DataControlRowState.Edit)
              {
                  using (DataClassesDataContext db = new DataClassesDataContext())
                  {
                      DropDownList dl = (DropDownList)e.Row.FindControl("DDL_Types1");
                      dl.DataSource = db.PartyTypes.Select(t =&gt; t).ToList();
                      dl.DataBind();
                      dl.SelectedValue = DataBinder.Eval(e.Row.DataItem, "type_id").ToString();
                      DropDownList dl1 = (DropDownList)e.Row.FindControl("DDL_CountryNames1");
                      dl1.DataSource = db.Countries.Select(c =&gt; c).ToList();
                      if (!string.IsNullOrEmpty(DataBinder.Eval(e.Row.DataItem, "country_id").ToString()))
                      {
                          dl1.SelectedValue = DataBinder.Eval(e.Row.DataItem, "country_id").ToString();
                          DropDownList dl2 = (DropDownList)e.Row.FindControl("DDL_StateNames1");
                          dl2.DataSource = db.States.Where(s =&gt; s.country_id.Equals(int.Parse(DataBinder.Eval(e.Row.DataItem, "country_id").ToString()))).Select(s =&gt; s).ToList();
                          dl2.DataBind();
                      }
                      DataRowView rowView1 = (DataRowView)e.Row.DataItem;
                      if (rowView1["UserOFC"] != null)
                      {
                          (e.Row.FindControl("chk_UserOFC1") as CheckBox).Checked = Convert.ToBoolean(e.Row.DataItem.Equals("UserOFC").ToString());
                      }
                      if (rowView1["UserVAT"] != null)
                      {
                          (e.Row.FindControl("chk_UserVAT1") as CheckBox).Checked = Convert.ToBoolean(e.Row.DataItem.Equals("UserVAT").ToString());
                      }
                      if (rowView1["UserINV"] != null)
                      {
                          (e.Row.FindControl("chk_UserINV1") as CheckBox).Checked = Convert.ToBoolean(e.Row.DataItem.Equals("UserINV").ToString());
                      }
                      if (rowView1["UserNone"] != null)
                      {
                          (e.Row.FindControl("chk_UserNone1") as CheckBox).Checked = Convert.ToBoolean(e.Row.DataItem.Equals("UserNone").ToString());
                      }
                  }
              }
  ..................
  }
  </code></pre>
  
  <p>Is this right method to binds drop down list at row editing mode.</p>
  
  <p>please help me....</p>