asp.netgridviewdatatemplatevisibledata-controls

Always show FooterTemplate, even no data


Is there a short way to make a FooterTemplate (in a GridView) always visible, even when DataSource is empty?


Solution

  • If you want it to always display, regardless of content, can't you just put the footer html outside the GridView, instead of in the FooterTemplate?

    If that's not an option for some reason, then you can either add an null row to your data source if it's empty, or subclass the GridView & override the default behaviour.

    Those are the only options I'm aware of (although its been a while since the last time I used a GridView).