Hi
I am using jquery ui
tabs
.While using the tabs i came across a scenario where, druing postback the tab is not maintaing the selected index.I searched it and found out the solution.My problem is the value in the hidden field is set to null during postback and as a result selected index cannot be maintained during postback in jquery ui
tabs
.
How can i solve this issue?
Heres my code
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js">
<script type="text/javascript">
$(function(){
//maintaining selected tab during postback
var selectedIndex=$("#<%=hFieldTabIndex.ClientID %>").val();
alert(selectedIndex)//here value is always set to null
if(selectedIndex==""){
$("#tabs").tabs({active:0});
}
else{
$("#tabs").tabs({active:1});
}
//Change the text of the button on tab change
$("#tabs").on("tabsactivate",function(){
var index=$("#tabs").tabs("option","active");
$("#<%=hFieldTabIndex.ClientID %>").val(index);//setting the hiddenfield value
alert($("#<%=hFieldTabIndex.ClientID %>").val());//showing currect tab index
if(index=="0"){
$("#btnNext").attr('value','Next>>')
}
else{
$("#btnNext").attr('value','<<Prev')
}
})
});