GridView编辑中DropDownList如何绑定DataSet?急用
我属于菜鸟级的,请大家多多包涵!类VisitCheckStuHomeworks中s_SelectTeacherSubject是我写的一个查询方法
protected void g_SelectHomeworks_DataBound(object sender, EventArgs e)
{
DropDownList dl = (DropDownList)this.g_SelectHomeworks.Rows[0].FindControl("DropDownList2");
int tid = 1;
DataSet ds1 = VisitCheckStuHomeworks.s_SelectTeacherSubject(tid);
string name = ds1.Tables[0].Columns[1].ToString();
string id = ds1.Tables[0].Columns[0].ToString();
dl.DataSource = ds1.Tables[0].DefaultView;
dl.DataTextField = Eval("name").ToString();
dl.DataValueField = Eval("id").ToString();
dl.DataBind();
}