宣化房产信息:解释下面的问题?谢谢

来源:百度文库 编辑:高考问答 时间:2024/04/24 23:37:46
System.Web.UI.WebControls.DataList InLayer;
InLayer=(DataList)e.Item.FindControl("Datalist3");

YsDAO.ProductClass dao=new YsDAO.ProductClass();
int DataKey=Convert.ToInt32(this.DataList2.DataKeys[e.Item.ItemIndex]);
DataTable dt= dao.ProductClass_Top6SecondClassUnderThisBigClass(DataKey);
InLayer.DataSource=dt;
InLayer.DataBind();

这是一段数据绑定的代码啊,有什么问题!
System.Web.UI.WebControls.DataList InLayer;
InLayer=(DataList)e.Item.FindControl("Datalist3");
//找到Datalist3,并实体化为InLayer;
YsDAO.ProductClass dao=new YsDAO.ProductClass();
//实例化一个类dao
int DataKey=Convert.ToInt32(this.DataList2.DataKeys[e.Item.ItemIndex]);
//声明一个DataKey变量,并赋值
DataTable dt= dao.ProductClass_Top6SecondClassUnderThisBigClass(DataKey);
//实体化一个DataTable,名为 dt
InLayer.DataSource=dt;
InLayer.DataBind();
//给InLayer指明DataSource,然后绑定!