Note that there are some explanatory texts on larger screens.

plurals
  1. POSync up server side control from JavaScript
    primarykey
    data
    text
    <p>I have the following scenario:</p> <p>I have two panels, with links to switch between the two, these links DON'T post back the page, they call some JavaScript code that fades in and out the panels, changing their visibility.</p> <p>In either panel I have a button that posts back the page, what happens is, after I fade in the second panel, my viewstate is invalid and my postback fails.</p> <p>Is there a way to make my viewstate valid from JavaScript synching the visibility of these two panels? Or do I have to postback for this to work? If so, can I postback without the page blinking in my face and nicely fade the panels?</p> <p>EDIT: This is somewhat the code that I have, obviously I have a bunch of controls inside the divs</p> <pre><code>&lt;div id="step_one" class="lt-step-1"&gt; &lt;asp:Button Text="Entrar" ID="btnPost1" OnClick="btnPost1_Click" ValidationGroup="Step1Val" CssClass="btn btn-primary lt-width-5" runat="server" /&gt; &lt;a href="#" id="link_Step_Two"&gt;&lt;span class="icon-repeat"&gt;&lt;/span&gt;Step Two&lt;/a&gt; &lt;/div&gt; &lt;div id="step_two" class="lt-step-2 hide"&gt; &lt;asp:Button Text="Confirmar" ID="btnPost2" OnClick="btnPost2_Click" ValidationGroup="Step2Val" CssClass="btn btn-primary lt-width-5" runat="server" /&gt; &lt;button type="button" id="btn_cancel_step_two" class="btn"&gt;Cancelar&lt;/button&gt; &lt;/div&gt; &lt;script&gt; require(['jquery', 'bootstrap'], function ($) { 'use strict'; var $stepOne = $('#step_one'), $stepTwo = $('#step_two'), $allSteps = $('[id^="step_"]'), $link_Step_Two = $('#link_Step_Two'), $btnCancelStepTwo = $('#btn_cancel_step_two'), $link_Step_Two.on('click', function () { $allSteps.hide(); $stepTwo.fadeIn(); }); $btnCancelStepTwo.on('click', function () { $allSteps.hide(); $stepOne.fadeIn(); }); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload