asp.net bootstrap Keep current active tab after post-back event

后端 未结 2 843
不知归路
不知归路 2020-12-21 21:30

I have the following asp.net aspx code

Search

        
相关标签:
2条回答
  • 2020-12-21 21:46

    I tried your script and it solved one of my problems, i added this code to my submit button

    Response.Redirect("Settings.aspx#step2");

    Hope it works for yours

    0 讨论(0)
  • 2020-12-21 22:06

    Not familiar with jQuery so i sought an asp.net solution when i had this problem. I solved this problem by altering the a href in the Lists and replaced with asp:linkbutton. Then i also went to the divs containing the tabs and added runat = "server" to each one, also added ID="Tab1" , Tab2 and so on. Then on the code behind for the linkbuttons i added the following code

    Me.Tab1.Attributes("class") = "tab-pane active"
    Me.Tab2.Attributes("class") = "tab-pane"
    Me.Tab3.Attributes("class") = "tab-pane"
    

    For the tab you want to be active you change the attribute to tab-pane active. This way when the linkbutton is clicked only the tab you want to be active is active and on postback because these controls are now server side you will remain on the active tab.

    0 讨论(0)
提交回复
热议问题