1.In you ASP page, first you need to have to register/load the javascript that define the popup in
window.onload
event then like in the next example.
window.onload = function () {
$("#popupdiv").dialog({
title: "jQuery Popup from Server Side",
width: 430,
height: 250,
modal: true,
buttons: {
Close: function () {
$(this).dialog('close');
}
}
});
};
2.Also in the same ASP script block (but NOT in the
onload
event!) to add a new script for opening the popup:
function openPopup() {
$("#popupdiv").dialog("open");
}
3.Finally in your C# code to invoke this 2nd javascript to activate the popup:
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "openPopup();", true);