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 8174315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:25:14+00:00 2026-06-06T22:25:14+00:00

I’ve created a simple example to show what I’m having problems with. Place a

  • 0

I’ve created a simple example to show what I’m having problems with. Place a asp.net checkbox on a page and an asp.net textbox on the same page. In the code behind (using vb.net), put code that displays something in the textbox when the checkbox is checked and displays an empty textbox when the check box is not checked. Simple, right? Now toggle back and forth several times with the checkbox checked/unchecked and the textbox has content/no content. Everything works fine – right?

Now click your back button on your browser a few times. The results being displayed with each back button click is opposite – check box is checked yet nothing in the textbox. Checkbox is unchecked and there is text in the textbox. It doesn’t matter where you put the vb code (page load, checkedchanged) – same results.

I’m thinking that it has something to do with the timimg of the page being saved in cache. Something like the page is being saved in the cache while the checkmark is firing the “click” event yet the code to fill the textbox has not yet been fired. Then again I could be completely off the mark and it is something real simple that I’m doing wrong.

Any ideas/thoughts/help would be greatly appreciated.

Sample Code:

ASPX:

<asp:CheckBox id="ChkBox1" runat="server" AutoPostBack="True" text="Sample" /><br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

VB:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If ChkBox1.Checked = True Then
            TextBox1.Text = "Checked"
        Else
            TextBox1.Text = ""
        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-06T22:25:16+00:00Added an answer on June 6, 2026 at 10:25 pm

    This is the way it should be.

    Browsers remember every time you post back to the server. Your page is posting back whenever the checkbox state changes.

    When the checkbox state is checked, the textbox is indeed empty. This is when the postback occurs. Your server side code sets the text value, and you see it in the browser.

    But your back will remember what you sent, that was a checked checkbox and empty text.

    The reserve case happens when you uncheck.

    If you refresh one of those back pages with a F5, your browser should ask to send back post data. And you will get back to the expected state.

    Tell the browser not to cache the content(if you want the browser to forget it):
    Not VB code, but I am sure you will find similar functions on VB.net too.

    context.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
    context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    context.Response.Cache.SetNoStore();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.