How to open a aspx page as Modal popup.
Let Test1.aspx has one button. On click it should populate Test.aspx page as Modal popup.
Here is my button:
<asp:Button ID="Button1" runat="server" Text="Fill Form in Popup" />
NOTE: Test.aspx : Normal aspx page but Test1.aspx: Parent page Contain master page.
If you want to open this as jQuery model dialog, see this post
Otherwise, If you want to open this page in a Modal Dialog you can use the following code to open it up. This examples use window.showModalDialog method of javascript. To find details how to use you can refer here.
<script>
function fnRandom(iModifier) {
return parseInt(Math.random() * iModifier);
}
function fnSetValues() {
var oForm = document.getElementById('oForm');
var iHeight = oForm.oHeight.options[oForm.oHeight.selectedIndex].text;
if (iHeight.indexOf("Random") > -1) {
iHeight = fnRandom(document.body.clientHeight);
}
var sFeatures = "dialogHeight: " + iHeight + "px;";
return sFeatures;
}
function fnOpen() {
var sFeatures = fnSetValues();
window.showModalDialog("test.aspx", "", sFeatures)
}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With