Can elements maintain state after postback

Posted on 2006-05-21
Last Modified: 2010-05-19
Is there a way to maintain the current state of an html element (whether it's checked or unchecked) when you post back a page? If so, could someone provide an example? None of these elements are in the code behind file, so using Not IsPostBack won't work, unless there's a way to place them there.

Right now, when my page refreshes, all the elements are reset to their defaults.

Question by:barnesco
    LVL 3

    Assisted Solution

    Can you post details as to what server side language you are using? Looks like ASP with some VBScript.

    The only way, to my knowledge, to save state between refreshes is to somehow post the data to a form, then populate the state of the objects using the form data.  
    LVL 75

    Accepted Solution

    How about a cookie?
    LVL 41

    Assisted Solution

    You could using something like cookies, or a database

    Author Comment

    Hadn't thought about cookies and using a database might be even better. I've been using hidden variables on page.


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (, typical array handling might look like this: (CODE) B…
    The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now