Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
14 Points
6 Posts
Jan 04, 2007 05:06 PM|LINK
I think I've got a fix for the EmptyDataTemplate issue:
Add the following to RenderContents in GridViewAdapter.cs right before the ///// BODY //// section
/////////////// EmptyDataTemplate /////////////////////// if (gridView.Rows.Count == 0) { //Control[0].Control[0] s/b the EmptyDataTemplate. if (gridView.HasControls()) { if (gridView.Controls[0].HasControls()) { if (gridView.Controls[0].Controls[0] is GridViewRow) { rows.Clear(); rows.Add(gridView.Controls[0].Controls[0]); gvrc = new GridViewRowCollection(rows); WriteRows(writer, gridView, gvrc, "tfoot"); } } } }
Add the following to GetRowClass right before return className.Trim();
//// EmptyDataTemplate if ((row.RowType & DataControlRowType.EmptyDataRow) == DataControlRowType.EmptyDataRow) { className += " AspNet-GridView-Empty "; }
Finally, if you want to override the standard tfoot style, add a CSS section in GridViewExample -
/* Optional AspNet-GridView-Empty to override tfoot used for EmptyDataTemplate */ .AspNet-GridView table tfoot tr.AspNet-GridView-Empty td { color: #F7F6F3; background: #5D7B9D; font-weight: bold; border-bottom: solid 1px #CCCCCC; border-right: solid 1px #CCCCCC; padding: 2px; }
I've only worked with the GridView so far, hopefully someone can adapt this where necessary.
-Chris
Christopher_...
Member
14 Points
6 Posts
Support for EmptyDataTemplate
Jan 04, 2007 05:06 PM|LINK
I think I've got a fix for the EmptyDataTemplate issue:
Add the following to RenderContents in GridViewAdapter.cs right before the ///// BODY //// section
/////////////// EmptyDataTemplate /////////////////////// if (gridView.Rows.Count == 0) { //Control[0].Control[0] s/b the EmptyDataTemplate. if (gridView.HasControls()) { if (gridView.Controls[0].HasControls()) { if (gridView.Controls[0].Controls[0] is GridViewRow) { rows.Clear(); rows.Add(gridView.Controls[0].Controls[0]); gvrc = new GridViewRowCollection(rows); WriteRows(writer, gridView, gvrc, "tfoot"); } } } }Add the following to GetRowClass right before return className.Trim();
Finally, if you want to override the standard tfoot style, add a CSS section in GridViewExample -
I've only worked with the GridView so far, hopefully someone can adapt this where necessary.
-Chris