Saturday, September 27, 2014

Postback events not working in pop up Asp.net

Most popup  such as bpopup , colorbox, lightboxt etc   move the content to the body, so if the form is not inside the popup div, the form elements ar no longer in the form, and not included in the postback. Look at the produced html using firbug in browser here you can find that html outside the from tag. So you  have to write javascript program to move the content from  body tag to from tag for example :

<script type="text/javascript">

        $(function () {

            var colorbox = $('.inline').colorbox({ open: true, inline: true, onOpen: ContentMovePostBack });
          
        });

        function ContentMovePostBack() {
            $("div#cboxOverlay").appendTo("form:first");
            $("div#colorbox").appendTo("form:first");
        }
    </script>
bpopup


                $('#my-button').bind('click'function (e) {
                    e.preventDefault();
                    $('#UserPopup').bPopup();

                    //
                    $('#UserPopup').appendTo("form:first");

                });

No comments:

Post a Comment

http://blogsiteslist.com