Solved

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

Posted on 2013-01-28
5
169 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

862 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

24 Experts available now in Live!

Get 1:1 Help Now