I have an ASP.NET 2.0 (C#) web app, and in it I have a gridview that gets its data from an oracle database.
I want to know how to check if the gridview is empty, and the do something.
I have already tried:
if(GridView.Rows.Count == 0) { // Do Something }
but it doesn’t work…
Any ideas?
Thank you.
Your code should work. But only after GridView.DataBind() has been called. Generally I don’t check the GridView it’s self, but the datasource of the grid view.