protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
obj.da = new SqlDataAdapter("select Group_ID, Group_Name from dbo.Group_Details where MobileNo='" + Session["MobNo"].ToString() + "'", obj.cn);
ds.Reset();
obj.da.Fill(ds);
DropDownList groupdwn = (DropDownList)e.Row.FindControl("DropDownList2");
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
groupdwn.DataSource = ds;
groupdwn.DataValueField = "Group_ID";
groupdwn.DataTextField = "Group_Name";
groupdwn.DataBind();
groupdwn.Items.Insert(0, new ListItem("Select", "0"));
}
else
{
groupdwn.DataSource = null;
groupdwn.DataBind();
groupdwn.Items.Insert(0, new ListItem("Select", "0"));
}
}
}