Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-04-2011, 07:46 PM   PM User | #1
chewy
New Coder

 
Join Date: Sep 2010
Posts: 13
Thanks: 4
Thanked 0 Times in 0 Posts
chewy is an unknown quantity at this point
Help with gridview

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:
Code:
     <%
         
        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.
chewy is offline   Reply With Quote
Old 05-06-2011, 07:44 PM   PM User | #2
Mike_O
Regular Coder

 
Join Date: Apr 2009
Posts: 244
Thanks: 1
Thanked 20 Times in 20 Posts
Mike_O is an unknown quantity at this point
Hey chewy,

Seems to me like your logic should work (http://msdn.microsoft.com/en-us/libr...ydatatext.aspx).

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

Mike
Mike_O is offline   Reply With Quote
Old 05-17-2011, 03:43 AM   PM User | #3
giunda1
New to the CF scene

 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
giunda1 is an unknown quantity at this point
i think you should do that!
GridView1.row.count==0
else
make another
you can see in my site barbie dress up games and cooking games
giunda1 is offline   Reply With Quote
Reply

Bookmarks

Tags
asp.net, login, vb.net

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:50 AM.


Advertisement
Log in to turn off these ads.