Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8649843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:39:25+00:00 2026-06-12T13:39:25+00:00

I’m using the code below to determine whether or not the page should show

  • 0

I’m using the code below to determine whether or not the page should show images or not. The button “works” sometimes, but other times it will take 2 or 3 clicks in order for the images to display.

Am I missing something?

    Private Sub btnViewAll_Click(sender As Object, e As System.EventArgs) Handles btnViewAll.Click
    If Session("fullPage") IsNot Nothing Then
        If CInt(Session("fullPage")) = 0 Then
            Session("fullPage") = 1
        Else
            Session("fullPage") = 0
        End If
    Else
        Session("fullPage") = 1
    End If
End Sub

I check for the session here:

Protected Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gvFolders.RowDataBound

    If CInt(Session("fullPage")) = 1 Then
      ...load images....
    End If

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:39:26+00:00Added an answer on June 12, 2026 at 1:39 pm

    My guess is that you are setting your Session variable after you have referenced it.

    For example, if you are using the variable in the Page_Load, then on the first click the value will be False by default (causing you to not render the images). After the Page_Load event has finished, the click event handler will fire, setting the session variable to True. But, since Page_Load has already finished, you will not see the images until after Page_Load is called again (on the second postback).

    This is only one example of what can happen when you are not paying close attention to the page life cycle. Since we can’t see your code, it’s impossible to know exactly where the logic error is occurring.

    See the ASP.NET Page Life Cycle for more information about the order of events.


    EDIT
    You may need to move some of your logic from the Page_Load to the Page_LoadComplete event. LoadComplete is usually the best place to do data binding, etc, after you have processed your control events.

    To answer your question in the comments below, the session handling is actually in the appropriate place. I can’t see where you are calling GridView1.DataBind(), but most likely it is that code which is not in the correct place. Move the DataBind call to the LoadComplete page event, and you should be set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.