Introduction
Most jquery popup such as bpopup
, colorbox
, lightboxt
, etc. render outside the form tag. So ASP.NET application these popup ASP.NET control is not working. So you have to write JavaScript program to move the content from body
tag to form
tag for example.
Using the JavaScript code:
$(function () {
var colorbox = $('.inline').colorbox({ open: true, inline: true, onOpen: ContentMovePostBack });
});
function ContentMovePostBack() {
$("div#cboxOverlay").appendTo("form:first");
$("div#colorbox").appendTo("form:first");
}
$('#my-button').bind('click', function (e) {
e.preventDefault();
$('#UserPopup').bPopup();
$('#UserPopup').appendTo("form:first");
});
History
- 23rd November, 2015: Initial version