我有一个带有页眉和页脚的 3 列(产品、数量、价格)的网格视图。我为产品页脚添加了一个下拉列表。现在我想将此下拉列表与数据集中的产品绑定,有人可以帮助我吗?我在cs文件中使用了以下代码,但在查找控件附近出现错误
“你调用的对象是空的。
protected void gv_page2_RowDataBound(object sender, GridViewRowEventArgs e)
{
dal = new DAL();
ds = new DataSet();
ds=dal.DALBindFooterDDL();
if (e.Row.RowType == DataControlRowType.Footer)
{
DropDownList ddl = (DropDownList)gv_page2.FooterRow.FindControl("ftrDDL");
ddl.DataSource = ds.Tables[0];
ddl.DataBind();
}
}