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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:49:02+00:00 2026-05-11T02:49:02+00:00

I am building a asp.net webforms (3.5 sp1) application, using jquery where I can

  • 0

I am building a asp.net webforms (3.5 sp1) application, using jquery where I can to animate the UI, change its state. It has worked great until I started doing postbacks, where the UI obviously resets itself to its initial state.

So my question is, what are the best practices for saving and restoring jquery/UI state between postbacks?

Thanks, Egil.

Update: Thanks a lot guys, great input, to bad I cant mark more than one answer as the ‘answer’.

  • 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. 2026-05-11T02:49:03+00:00Added an answer on May 11, 2026 at 2:49 am

    I typically store things like menu state or filter (set of inputs in a div) visibility, etc. server-side in the session via AJAX. When a menu expands or a filter is shown, the click handler will fire an AJAX event to a web service that will record the state of the menu or filter visibility in the user’s session. On a postback I use the session variables corresponding to each menu/filter to set it’s initial state via CSS. I find that this is better user experience since the page doesn’t flash when it is updated by javascript after loading if you make the changes client-side.

    Example — as I’m on the road this not actual code from a project and may be incomplete. Uses jQuery. The Url for the web service is going to depend on how you implement web services. I’m using ASP.NET MVC (mostly) so mine would be a controller action.

    <script type='text/javascript'>     $(document).ready( function() {        $('#searchFilter').click( function()  {            var filter = $(this);            var filterName = filter.attr('id');            var nowVisible = filter.css('display') === 'none';            if (nowVisible) {               filter.show();            }            else {               filter.hide();            }            $.post('/controller/SetFilterVisibility',                   { name: filterName, visibility: nowVisible } );        });     }); </script>   <div id='searchFilter' <%= ViewData['searchFilterVisibility'] %> >     ... </div> 

    Server-side code

    [AcceptVerbs( HttpVerbs.POST )] [Authorization] public ActionResult SetFilterVisibility( string name, bool visible ) {     Session[name] = visible;     return Content( string.Empty );  // not used...  }  [AcceptVerbs( HttpVerbs.GET )] [Authorization] public ActionResult SomeAction( int id ) {     ...     ViewData['searchFilterVisibility'] = Session['searchFilter'];     ...     return View(); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 116k
  • Answers 116k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, there is a difference. From the java docs: Copy:… May 11, 2026 at 10:39 pm
  • Editorial Team
    Editorial Team added an answer myLabel.setStyle("fontWeight", "bold"); May 11, 2026 at 10:39 pm
  • Editorial Team
    Editorial Team added an answer You are only looking at the first li child in… May 11, 2026 at 10:39 pm

Related Questions

I am a solo dev building a WinForm App, C# & .Net 3.5, in
I have a scenario inwhich users of a site I am building need the
My team is considering building our next web app using the ASP.NET MVC framework.
I am building a site in asp .net 2.0 web forms. When I load

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.