Solved

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

Posted on 2013-01-28
5
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

695 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