Thursday, August 4, 2011

Tip/Trick: Show Header and Footer of GridView when no Data returned.

reference : 1) http://geekswithblogs.net/dotNETvinz/archive/2009/03/11/tiptrick-show-header-and-footer-of-gridview-when-no-data.aspx

2)http://stackoverflow.com/questions/3437581/show-gridview-footer-on-empty-grid

To Access Footer when no Grid Data
when grid source has no data, you have the row from emptydataTemplate which is not placed in normal Rows collection but is nested in Control(0) of gridview (which is a ChildTable that comes from System.Web.Ui.Controls and it is a
System.Web.UI.WebControls.Table

in these situations you can get the gridviewRow this way:
vb code
dim dr as GridViewRow= gridview1.Controls(0).Controls(0)
c# code
GridViewRow dr= gridview1.Controls[0].Controls[0];

No comments:

Post a Comment

Devops links

  Build Versioning in Azure DevOps Pipelines