Fancybox - ASP.NET button not working

前端 未结 14 948
一生所求
一生所求 2020-12-01 02:13

I\'ve just determined using Firebug that when Fancybox window is created it actually takes all of my ASP.NET controls (contained in DIV tag) and puts them outside FORM tag.

相关标签:
14条回答
  • 2020-12-01 03:02

    Without altering the FancyBox source, put this after the FancyBox script (outside any load events!!!):

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/#.#/jquery.min.js"></script>
    <script type="text/javascript" src="/fancybox/jquery.fancybox-#.#.#.pack.js"></script>
    <script type="text/javascript">
    
        // Override $.fancybox.init to fix ASP.NET PostBack bug;
        var fancyboxInitOld = $.fancybox.init;
        $.fancybox.init = function () {
            fancyboxInitOld.apply(arguments);
            $("#fancybox-tmp, #fancybox-loading, #fancybox-overlay, #fancybox-wrap").appendTo("form:first");
        };
    
        // Your code ...
    
    </script>
    
    0 讨论(0)
  • 2020-12-01 03:05

    You don't need to change any code or any library... Just try this..

    $('.fancybox').fancybox({
         parent: "form:first", // jQuery selector
    });
    
    0 讨论(0)
提交回复
热议问题