Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    13
    Thanks
    4
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    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

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •