Javascript and AJAX Postback

2 posts, 0 answers
  1. Steve
    Steve avatar
    60 posts
    Member since:
    Nov 2006

    Posted 12 Sep 2009 Link to this post

    Very simple scenario...I have a form with a div that is initially displayed.  I have a simple span with an "onclick" that toggles whether the div is displayed using the div's style.display attribute.  The form also has controls on it that do ajax postbacks to update other controls.  Let's say I hide the div client-side, then do an ajax postback.  When the ajax postback is done, the div goes back to being displayed as it was when the form initially loaded.  How can you maintain things that happen client-side with javascript after an ajax postback occurs.  If I hide the div setting style.display = 'none' and then do an ajax postback, i want the div to still be hidden.  Any help?
  2. Martin
    Admin
    Martin avatar
    833 posts

    Posted 15 Sep 2009 Link to this post

    Hello Steve,

    You will need to set the display attribute of the div element on the server too. Otherwise the client setting will be overridden with every regular postback or AJAX callback.

    I hope this helps.

    Regards,
    Martin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top