Active Index is not being persisted in jQuery accordion change event
- by Xaisoft
I have an asp.net aspx page and on that page I have a hidden input field with and id of paneIndex.  However, when I load the page, the alert shows index 1 which is correct on the first load, but if I open up pane 3 for example, the alert shows 1 still.  Am I doing something wrong?
In a Custom.js file, I have the following code:
$(document).ready(function() {
    $("#accordion").accordion({
        active: 1,
        collapsible: true,
        autoHeight: false,
        change: function(event, ui) {
            var activeIndex = $("#accordion").accordion('option', 'active');
            $("#paneIndex").val(activeIndex);
           //alert(activeIndex);
       }
    });
});
In my server side button click, I have the following code:
string activeIndex = Request.Form["paneIndex"];
string script = string.Format(@"<script type=""text/javascript"">var paneIndex = 
                                {0};</script>", activeIndex);
  if(!ClientScript.IsStartupScriptRegistered("JSScript"))
      ClientScript.RegisterStartupScript(this.GetType(),"JSScript", script);