开发者

Jquery - Updatepanel conflict

Description:

I added updated to my asp.net page in which I am also using Jquery. But jquery stopped functioning when any partial postback occurs (document.ready() is not being invoked).

Sample code:

 <script type="text/javascript">
    $(document).ready(function () {
        $("SELECT").selectBox();

}

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
 <asp:Dropdownlist id="ddlproduct" runat="server"      onselectedind开发者_开发问答exchange="function"></asp:Dropdownlist>

Any suggestions

Thanks in advance


Since you're using a ScriptManager and UpdatePanel Use the ASP.NET AJAX pageLoad() function. It runs on Init and after EndRequest as well, so it will work both when you load up the page as well as on every update from an UpdatePanel.

You may want to put in a check to see if the dropdown has already been converted to the stylized dropdown though, for performance considerations.

<script type="text/javascript">
  function pageLoad() { 
    $("select").selectBox();
  }
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜