62,268
社区成员
发帖
与我相关
我的任务
分享protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList goodsType = (DropDownList)e.Row.FindControl("DropDownList1");
if (goodsType != null)
{
con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestProviderConnectionString"].ConnectionString);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from goodsType",con);
da.Fill(ds,"gt");
goodsType.DataSource = ds.Tables["gt"];
goodsType.DataTextField = "goodsType";
goodsType.DataValueField = "goodsId";
goodsType.DataBind();
}
}
}