Aspx, Entity, on my gridView I made a footer for a new button. It shows when there are items, but not when data is empty. gridView’s ShowFooter = True. Not sure why it won’t show when empty, is there another property I maybe missing? I know a workaround could be place a dummy row in the database, but think there should be a better way to start off at 0. If you have any more questions, please ask.
<asp:TemplateField HeaderText="New" >
<FooterTemplate >
<asp:Button ID="btnNew" CssClass="DDButton" runat="server" Text="New" CommandName="New" OnClick="new_item" />
</FooterTemplate>
</asp:TemplateField>
.Net 4.0 added the
ShowHeaderWhenEmptyproperty on the GridView but unfortunately noShowFooterWhenEmpty. However there is still theEmptyDataTemplate:As this will not be in a
GridViewRowI don’t think yourRowCommandevent will fire but you seem to be handling the click of the button in a separate method anyway.Reference for
GridView.EmptyDataTemplate: http://msdn.microsoft.com/en-gb/library/system.web.ui.webcontrols.gridview.emptydatatemplate.aspx