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

Posted on 2013-01-28
Medium Priority
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.
Question by:sarang8180
  • 3
LVL 53

Expert Comment

ID: 38825881
Tip/Trick: Show Header and Footer of GridView when no Data returned.

Solution: Show Header/Footer of Gridview with Empty Data Source
LVL 53

Expert Comment

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

Accepted Solution

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

   <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>

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

EmptyDataTemplate example


Author Comment

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

Expert Comment

ID: 38862948
CanUserAddRows - my mistake: is for windows controls

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

587 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