Friday, September 12, 2008

Empty grid to show the header

If our resultset is contains no rows, the gridview didn't show the header.

To show the header in the gridview ,

We have to desing the gridview header in the Table and put it inside the EmptyDataTemplate of the gridview as given below.

<asp:GridView ID="GridView1" runat="server" CssClass="th">
<EmptyDataTemplate>
<table>
<tr>
<td>
<b>&Namelt;/b></td>
</tr>
</table>
</EmptyDataTemplate>
</asp:GridView>