简体   繁体   English

带有Runat服务器的Bootstrap选项卡在asp.net中不起作用

[英]Bootstrap tabs with runat server is not working in asp.net

<asp:Repeater ID="rpt_hotel_rooms" OnItemDataBound="rpt_hotel_rooms_ItemDataBound" runat="server">
    <ItemTemplate>
        <ul class="nav nav-tabs item">
            <li id="royal_tab" runat="server" class="active"><a data-toggle="tab" href="#royal">ROYAL</a></li>
            <li id="splendid_tab" runat="server"><a id="spl" data-toggle="tab" href="#splendid">SPLENDID</a></li>
        </ul>

        <div class="tab-content">
            <div id="royal" runat="server" class="tab-pane fade in active">
                <%# Eval("hotel_royal") %>
            </div>
            <div id="splendid" runat="server" class="tab-pane fade">
                <%# Eval("hotel_splendid") %>
            </div>
        </div>
    </ItemTemplate>
</asp:Repeater>

When i remove the runat server attr of div id=royal and id=splendid then the code will work properly but when i add runat server attr after that bootstrap tabs not working. 当我删除div id = royal和id = splendid的runat服务器attr时,代码将正常工作,但是当我在该引导程序选项卡后无法添加runat服务器attr时。

i want hide that div when i need. 我想在需要时隐藏该div。 thats why i am adding runat server to manage both div from code-behind. 那就是为什么我要添加runat服务器来从代码隐藏管理两个div。

What should i do? 我该怎么办?

if there is a another way to repeater inner div's without adding runat server then tell me please. 如果有另一种方法可以在不添加runat服务器的情况下转发内部div,请告诉我。

Thank you in advance... :) 先感谢您... :)

Better way if you can do div hide in client side, depend on the condition you want to hide it.can write onclick event there and can write a javascript function to hide or display div. 如果可以在客户端进行div隐藏,更好的方法是根据要隐藏它的条件而定。可以在其中写入onclick事件,还可以编写JavaScript函数来隐藏或显示div。 Try once. 尝试一次。

而不是使用<div><asp:panel>ClientIDMode="Static"

<asp:Panel ID="royal" ClientIDMode="Static" runat="server" CssClass="tab-pane fade in active"> <%# Eval("hotel_royal") %> </asp:Panel>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM