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

  • Home
  • SEARCH
  • 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

Related Questions

Suppose I'm building a StackOverflow clone using webforms ASP.NET and jQuery. The Question page
I'm am building my asp.net web application using MVC (Preview 5), and am also
I'm building an ASP.NET web application, and all of my strings are stored in
I'm building an ASP.NET MVC application with a form that needs validation. The majority
Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI
I am building a hybrid MVC/Webforms application where my MVC views are using an
I am building an asp.net MVC2 web app using StructureMap. I have created a
Azure, probably ASP.NET Webforms. We're building a management interface for about 8 tables. Usual
We have a web application written in ASP.NET for .NET 3.5, using standard web
We are building asp.net application in which we want to log the received data

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.