Maintain Jquery selected tab on postback inside of update panel in asp.net

Aypn CNN 446 Reputation points
2021-06-04T08:45:02.287+00:00

Hi,

I have a jquery tab inside an update panel, but unable to maintain tab, pls ref my aspx page is attached.
102435-myaspxpg.txt

In code-behind, I have included this line.

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
 selected_tab.Value = Request.Form(selected_tab.UniqueID)  
 End Sub  

Thanks in advance.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,598 questions
0 comments No comments
{count} votes

Accepted answer
  1. XuDong Peng-MSFT 11,891 Reputation points Microsoft External Staff
    2021-06-07T07:40:25.45+00:00

    Hi @Aypn CNN ,
    According to your description, I test the code you provided, and modify some code in javascript to fix this issue ( both jquery ready() and MyScript()) . Like this:

    var tabs = $("#tabs").tabs({  
          select: function (e, i) {  
               selected_tab = i.index;  
               $("[id$=selected_tab]").val(selected_tab);  
           }  
    });  
    

    What you are missing is to record the user's choice and save it in HiddenField.

    Best regards,
    Xudong Peng


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.