View Full Version : Help with gridview

05-04-2011, 08:46 PM
Is there any way to check if a gridview is blank or if an accessdatasource doesn't display any info?

I know there is the EmptyDataText option in the gridview controls, but the problem with this is that I don't know how to make it not display if the user is logged in.

I tried doing something like this:


If Session("username") = "" Then
loggedIn.Text = "Please log in to see user profile"
GridView1.EmptyDataText = ""

End If
If Not Session("username") = "" Then
loggedIn2.Text = "User Info"
loggedIn3.Text = "Recent Orders"

End If

But that doesn't seem to actually make a change to the EmptyDataText.

05-06-2011, 08:44 PM
Hey chewy,

Seems to me like your logic should work (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.emptydatatext.aspx).

Maybe try saying:
GridView1.EmptyDataText = String.Empty
Also, are you certain you're hitting the Session("username") = "" condition?


05-17-2011, 04:43 AM
i think you should do that!
make another
you can see in my site barbie dress up games and cooking games (http://www.dollbabi.com/tags/Cooking)