Hello everyone,
I have an asp.net webform application on which I have added 15 accordions. The web controls on form has their autopostback property set to true but on autopostback the active accordion is getting collapse.
I searched and found the below link. But its not working for me, I am unable to figure it out where I am making mistake any suggestions will a great help and will be appriciated.
My code
<script type="text/javascript">
$(function () {
var paneName = $("[id*=PaneName]").val() != "" ? $("[id*=PaneName]").val() : "collapseOne";
//Remove the previous selected Pane.
$("#accordion .in").removeClass("in");
//Set the selected Pane.
$("#" + paneName).collapse("show");
//When Pane is clicked, save the ID to the Hidden Field.
$(".panel-heading a").click(function () {
$("[id*=PaneName]").val($(this).attr("href").replace("#", ""));
});
});
//On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
$("#accordion").accordion();
}
});
};
</script>