引导选择自动回发后失去风格 [英] Bootstrap select loses style after autopostback

查看:198
本文介绍了引导选择自动回发后失去风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的引导web表单Asp.net网站中。我dropdownlists铺有引导选择。

I'm using bootstrap within my Asp.net webforms site. My dropdownlists are styled with the bootstrap select.

这是DropDownList的一个UpdatePanel内。它被设置为自动回保存选择在我的数据库。这种保存工作正常。问题是,这个UpdatePanel的火灾(甚至是另一个我在同一页上)后,将DropDownList失去引导选择风格,成为一个普通下拉列表。

This dropdownlist is within an Updatepanel. It's set to Autopostback to save the selection in my database. This save is working fine. The problem is that after this Updatepanel fires (or even another one I have on the same page), the dropdownlist loses the bootstrap select style and become a regular dropdown.

<asp:UpdatePanel ID="UpdatePanelSupervisor1" runat="server">
    <ContentTemplate>
        <asp:DropDownList ID="ddlSupervisor1" runat="server" CSSClass="form-control select show-tick" data-live-search="true" AutoPostBack="True" onselectedindexchanged="ddlSupervisor1_SelectedIndexChanged"/>                                  
    </ContentTemplate>

    <Triggers>
        <asp:AsyncPostBackTrigger ControlID ="ddlSupervisor1" EventName ="SelectedIndexChanged" />
    </Triggers>

</asp:UpdatePanel>

我怎能自举风格DropDownList的一个UpdatePanel火灾后选择?

How can I keep the dropdownlist styled with bootstrap select after an updatepanel fires?

推荐答案

在处理头部分的页面加载事件,并使用jQuery设置类,

Handle the pageLoad event in head section and set the class using jquery,

<script type="text/javascript">
    function pageLoad() {
         $("#<% =ddlSupervisor1.ClientID %>").addClass("form-control select show-tick");
    }
</script>

这篇关于引导选择自动回发后失去风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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