更新时间:2022-02-20 02:53:26
您尝试 ^ ]这是第一个吗?或 CP文章 [
Did you try googling[^] this first? Or CP Articles[^]? Is this a windows forms app? Web app? What have you tried? Why isn''t it working? What errors are you getting?
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"));
}
}
}