Home > .Net > Show gridview header if no record in datatable

Show gridview header if no record in datatable

I found no good solution for it. Simple work around not solution is left girdview without header and set your message “Not record found” in gridview property “EmptyDataText”

Some other work around are listed below from different site.

From MSDN

<asp:GridView ID=”CustomersGridView” DataSourceID=”CustomersSqlDataSource” AutoGenerateColumns=”true”

runat=”server”>

<EmptyDataRowStyle BackColor=”LightBlue” ForeColor=”Red” />

<EmptyDataTemplate>

<asp:Image ID=”NoDataImage” ImageUrl=”~/images/Image.jpg” AlternateText=”No Image”

runat=”server” />

No Data Found.

</EmptyDataTemplate>

</asp:GridView>

From another forum almost similar

Comments are closed.

TOP