Dropdownlist in gridview footer
-
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[0].Text = //your bind data } }
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList objDDL=new DropDownList(); objDDL.TextField="DisplayFieldName"; objDDL.ValueField="ValueFieldName"; objDDL.datasource="yourdatasoruce" ; objDDL.DataBind(); e.Row.Cells[0].Controls.Add(objDDL); } } Hope this helps!
Coding C# www.excitetemplate.com
-
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList objDDL=new DropDownList(); objDDL.TextField="DisplayFieldName"; objDDL.ValueField="ValueFieldName"; objDDL.datasource="yourdatasoruce" ; objDDL.DataBind(); e.Row.Cells[0].Controls.Add(objDDL); } } Hope this helps!
Coding C# www.excitetemplate.com
protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.
-
protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.
Which line is giving error? Check if "dvAssembly" is null, if so fill it first with data.
Coding C# www.excitetemplate.com
-
protected void gvMandal_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly"); DataView dvAssembly = objGeneral.GetAssemblyNames(ddlDistrict.SelectedValue.ToString()); ddlAssembly.DataSource = dvAssembly; ddlAssembly.DataTextField = "sAssemblyName"; ddlAssembly.DataValueField = "nAssemblyID"; ddlAssembly.DataBind(); } } I used the code like this It is showing the error--> Object reference not set to an instance of an object.
4anusha4 wrote:
DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly");
is this the line where the error is generated....
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Which line is giving error? Check if "dvAssembly" is null, if so fill it first with data.
Coding C# www.excitetemplate.com
-
4anusha4 wrote:
DropDownList ddlAssembly = (DropDownList)gvMandal.FooterRow.FindControl("ddlAssembly");
is this the line where the error is generated....
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
DropDownList ddlAssembly = (DropDownList)e.Row.FindControl("ddlAssembly"); try this.
Coding C# www.excitetemplate.com
-
DropDownList ddlAssembly = (DropDownList)e.Row.FindControl("ddlAssembly"); try this.
Coding C# www.excitetemplate.com
-
Great :) My pleasure!!
Coding C# www.excitetemplate.com