To show a message when there is no row in gridview

If there exists no row in gridview , while fetching data from database , i want to show message"No data is present"....

How can i perform the above task
Sukesh ShuklaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you can do it via GridView setting... like adding:

<EmptyDataTemplate>No Record Available</EmptyDataTemplate>

ref:
How to Display the Empty GridView in case of no Records in Database
http://www.c-sharpcorner.com/UploadFile/d0e913/how-to-display-the-empty-gridview-in-case-of-no-records-in-d/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tapan PattanaikSenior EngineerCommented:
Hi Sukesh Shukla,

Asp.net GridView has EmptyDataText property. If there is no records found it will display "No data is present"

<asp:GridView ID="GridView1" runat="server" EmptyDataText="No data is present"></asp:GridView>

For more details please check the attachment.


Regards,
Tapan
No-Record-Found.PNG
Sukesh ShuklaAuthor Commented:
Thank You Tapan And Ryan Chong , for your help.........
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.