I have a grid view with 3 columns(Product, Quantity, Price) with header and footer. I added a dropdownlist for the Product footer. Now I want to bind this dropdownlist with products which is in dataset, can anyone help me?
i used the following code in cs file, but im getting error near find control as
“Object reference not set to an instance of an object.
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();
}
}
Use
RowCreated(orRowDataBoundevent) – for exampleDisclaimer: untested code – provided to get an idea/hint of actual soltion