ASP.NET, use data-toggle attribute in C# -


I have a bootstrap that has a tabbed menu to open this tab, attribute data-toggle = "tab" uses it. Now I have one button from the tab, and when I click on the button, it runs some C # code from the code behind the file. It uses the databind (), so the page will reload. However, when it reloads, the default tab is obviously open, but I want to reload it with opening a separate tab. Is there a way that I can run data-toggle from my C # code?

The HTML tab looks like this:

  & lt; ul class = "nav nav-tab" & gt; & Lt; Li runat = "server" id = "tabHome" class = "active" & gt; & Lt; a href = "# home" data-toggle = "tab" & gt; & Lt; I class = "fa fa-home" & gt; ; & Lt; / I & gt; Home and lt; / A & gt; & Lt; / li & gt; & Lt; li runat = "server" id = "tabUsers" & gt; & Lt; a href = "# profile" data-toggle = "tab" & gt; & Lt; I class = "fa fa-user" & gt; & Lt; / i & gt; Users & lt; / A & gt; & Lt; / li & gt; & Lt; Li runat = "server" id = "tabRoles" & gt; & Lt; a href = "# message" data-toggle = "tab" & gt; & Lt; I class = "fa fa-tags" & gt; & Lt; / i & gt; Roles & lt; / A & gt; & Lt; / li & gt; & Lt; li runat = "server" id = "tabGames" & gt; & Lt; a href = "#Settings" data-toggle = "tab" & gt; & Lt; I class = "fa f-trophy" & gt; & Lt; / i & gt; Games and lt; / A & gt; & Lt; / li & gt; & Lt; / Ul & gt;   

And within the tab "tab reels", I have a button that executes some code:

  if (roles! Rolexists (TxtRolename.Text)) {Roles.CreateRole (txtRolename.Text); BindUsers (); BindRoles (); Feedback.Visible = true; LblFeedback.Text = "& lt; Strong & gt; Success! & Lt; / strong & gt; Role" + txtRolename.Text + "was created."; TxtRolename.Text = ""; } And {// roll already exists blabla}    

Since you list each list Items are marked as "server controls" by id and runat properties, you can read these objects in your server-side code. Try using the property of the "item" collection to obtain data-toggle values, CSS classes etc. for each tab.

From there, you can use those values ​​to tie those client-side code and activate the appropriate tab on page load.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -