Display message and header when Gridview is empty in asp.net

Introduction: In this article I will explain how we can Display message and header when Gridview is empty.

Description:

In application we have to show the header and empty message when there no data in table. We can show that via code behind or use the Gridview property.  Easiest way to do this is use the Gridview control property. We have set only two property for this EmptyDataText and showHeaderWhenEmpty. See the given example below:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
            EmptyDataText="No data Found" ShowHeaderWhenEmpty ="true">    
        <Columns>
        <asp:BoundField DataField="emp_name" HeaderText="Employee Name"/>
         <asp:BoundField DataField="emp_adress" HeaderText="Address" />
          <asp:BoundField DataField="emp_salary" HeaderText="Salary" />     
        </Columns>
        </asp:GridView>

Is this article helpful for you?

If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email. 

Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget