如何在代码后面显示li控件的内容 [英] How to show the contents of a li control in code behind

查看:94
本文介绍了如何在代码后面显示li控件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的应用程序中,我使用UL和LI控件在LI中创建选项卡控件我有锚标记来调用div单击li控件时标记它正常工作。现在对于某些用户我想将另一个选项卡作为默认选项,我可以在选项卡后面的代码中更改li控件的类是活动的但选项卡内部的内容显示错误,它显示第一个选项卡内容我想要显示标签内容。我已将所有内容更改为runat = server但我无法显示该选项卡内容。你可以帮我解决这个问题。这是我的代码:



.aspx

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

<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

CorrectiveId.Attributes.Add("class", "active");



在上面的代码中,默认的活动选项卡是分析。在后面的代码我正在激活纠正措施,选项卡处于活动状态,但是不显示Corrective div中的内容,它显示分析div内容。



在此先感谢


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

推荐答案

还必须在您的TabContent div中添加active:



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

<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>


您必须使用javascript管理此内容。

生成javascript函数并从服务器端调用它。
you have to manage this thing using javascript.
make javascript function and call it from server side.


这篇关于如何在代码后面显示li控件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆