Solved

How to show button in GridView when there is no data in it.

Posted on 2013-01-28
5
167 Views
Last Modified: 2013-06-08
How to show button and columns in GridView when there are no rows in it.Because i cannot see any data.
0
Comment
Question by:sarang8180
  • 3
5 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 38825881
Tip/Trick: Show Header and Footer of GridView when no Data returned.
http://geekswithblogs.net/dotNETvinz/archive/2009/03/11/tiptrick-show-header-and-footer-of-gridview-when-no-data.aspx

Solution: Show Header/Footer of Gridview with Empty Data Source
http://forums.asp.net/t/960167.aspx
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 38825885
You should try setting CanUserAddRows to true
0
 
LVL 10

Accepted Solution

by:
Monica P earned 500 total points
ID: 38825913
Can use the "<EmptyDataTemplate>" Tag

<EmptyDataTemplate>
   <asp:Label runat="server" ID="lblNoRecord" Text="No Records Found."></asp:Label>

                 <asp:LinkButton runat="server" ID="lnk_Add_INV" Visible="true" Text="Add New informatio " OnClick="Add_Click"></asp:LinkButton>
               
</EmptyDataTemplate>

To access the controls in the emptydatatemplate refer http://forums.asp.net/p/1436652/3240106.aspx

EmptyDataTemplate example

http://shibashishdotnetocean.blogspot.com/2012/02/using-aspnet-gridview-emptydatatemplate.html
0
 

Author Comment

by:sarang8180
ID: 38854131
What is Dhaest...Where is the property called CanUserAddRows?I cannot find it
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 38862948
CanUserAddRows - my mistake: is for windows controls
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now