Protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)
{
# Region method for binding ItemTemplate
If (e. Row. RowType = DataControlRowType. DataRow)
{
DropDownList ddl = (DropDownList) e. Row. FindControl ("DropDownList1 ");
List <string> source = new List <string> ();
Source. Add ("House ");
Source. Add ("building ");
Ddl. DataSource = source;
Ddl. DataBind ();
CheckBox cb = (CheckBox) e. Row. FindControl ("CheckBox1 ");
Cb. Checked = true;
}
# Endregion
# Region bind EditItemTemplate
If (e. Row. RowState & DataControlRowState. Edit )! = 0 & e. Row. RowType = DataControlRowType. DataRow)
{
DropDownList ddl = (DropDownList) e. Row. FindControl ("DropDownList1 ");
List <string> source = new List <string> ();
Source. Add ("House ");
Source. Add ("building ");
Ddl. DataSource = source;
Ddl. DataBind ();
CheckBox cb = (CheckBox) e. Row. FindControl ("CheckBox1 ");
Cb. Checked = true;
}
# Endregion
}