Asp.Net/C#问题 (急救??????????????????)
你好:
我在DataGrid的绑定列里面放了一个DropDownList代表“年”,我想让它的值从表“年”里面动态绑定,请您帮我查一下我的代码哪里有错。
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
DataSet tmpDataSet=new DataSet();
DropDownList year=(DropDownList)e.Item.FindControl("myDropDownList");
//这行没错误,访问自定义函数,读取年表中的year字段;表“年”就只有一个字段year
tmpDataSet=this.mylow.SelectDataSet("年","year");
year.DataSource=tmpDataSet.Tables[0];
year.DataTextField="year";
year.DataBind();
}