Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my application I am using the UL and LI controls for creating a tab control inside the LI I am having the anchor tag to call a div tag when the li control is clicked it is working fine. Now for some user I want to make the another tab as default, I can able to change the class of the li control in code behind the tab is active but the content inside of the tab is showing wrongly, it is showing first tab content I want to show that tab content. I have changed all the things as runat=server but I can't able to show that tab content. Can u please help me to solve this issue. Here is my code:

.aspx
HTML
<ul  runat="server" class="nav nav-tabs bordered"> 
    <li  runat="server" id="AnalysId" class="active"><a href="#Analysis" data-toggle="tab">Analysis</a></li>
    <li  runat="server" id="CorrectiveId" class="" id=""><a href="#Corrective" data-toggle="tab">Corrective Action</a></li>
    <li  runat="server" id="ImplementId" class=""><a href="#Implementation" data-toggle="tab">Implementation</a></li>
</ul>

<div id="myTabContent" class="tab-content padding-10">
    <div class="tab-pane fade active in smart-form" id="Analysis"></div>
    <div class="tab-pane fade" id="Corrective"></div>
    <div class="tab-pane fade" id="Implementation">
</div> 

.aspx.cs
C#
CorrectiveId.Attributes.Add("class", "active");

In the above code the default active tab is analysis. In code behind I am making the Corrective Action to active, the tab is active but the content inside the Corrective div is not displayed it is displaying the Analysis div contents.

Thanks in Advance
Posted
Updated 24-Aug-14 8:55am
v2
Comments
ZurdoDev 25-Aug-14 7:43am    
Don't you have javascript that shows/hides the divs when clicking the tabs, or something like that? Sounds like you need to incorporate that too.
gggustafson 26-Aug-14 14:05pm    
You're missing a </div>

Also have to add "active" to your TabContent div:

XML
<div id="myTabContent" class="tab-content padding-10">
    <div class="tab-pane fade" id="Analysis"></div>
    <div class="tab-pane fade active in smart-form" id="Corrective"></div>
    <div class="tab-pane fade" id="Implementation"></div>
</div>
 
Share this answer
 
you have to manage this thing using javascript.
make javascript function and call it from server side.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900