1
我有一個3列(產品,數量,價格)與頁眉和頁腳的網格視圖。我爲產品頁腳添加了一個下拉列表。現在我想將此下拉列表與數據集中的產品綁定,任何人都可以幫助我? 我以前在CS文件下面的代碼,但作爲GridView的頁腳內部的綁定下拉列表
「對象引用不設置到對象的實例即時得到附近發現控制誤差
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();
}
}
你應該使用gridview RowDataBound事件 – Rajpurohit