ModalPopup @ Page_Load

Posted by Sathya4260 under ASP.NET AJAX on 1/28/2011 | Points: 10 | Views : 5267 | Status : [Member] | Replies : 6
Hi experts,

Can you guide me to pop up an modalpopup box on page_load using c# in asp.net and calling code should be in code behind page

and I have to place an dropdown list in the box.

As usual i should not use jquery or scripts to call the modal pop up box,

Kindly replay ASAP

Sathish Kumar S


Responses

Posted by: Prabhakar on: 1/28/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Sathya4260

u want to pop up ur page in Popup Box so write this script in Head tag .. when page load.. popup atomatic genrated ...

<script language="JavaScript" type="text/javascript">

function PopUp()
{
var URL = "./LatestPopUp2.aspx";
var Name = "popup";
var Fensteroptionen = "toolbar=0,scrollbars=0,location=0,titlebar=0,statusbar=1,menubar=0,resizable=0";
var Breite =690;
var Hoehe = 530;
var to=50;
var la=100;
window.open(URL, 'Name', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe +',top='+ to +',left='+ la );
}
window.onload=PopUp()

</script>

Best Regard's
Prabhakar

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathya4260 on: 1/28/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks praba,

But i am using Ajax modal pop up


Sathish Kumar S

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/28/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi Sathish,

For modal pop up you can use something like below. Since you dont want scripts to run

protected override void OnLoad(EventArgs args)
{ base.OnLoad(args);
if (!IsPostback)
myModalPopupProperties.Show();
}

Thanks
Karthik
www.f5Debug.net

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathya4260 on: 1/28/2011 [Member] Starter | Points: 25

Up
0
Down
can you explain what is base.onload, and by what the method onload is called

Sathish Kumar S

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathya4260 on: 1/28/2011 [Member] Starter | Points: 25

Up
0
Down
when i call,

myModalPopupProperties.Show();

It showing error as target control id should be null or empty


Sathish Kumar S

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sathya4260 on: 1/28/2011 [Member] Starter | Points: 25

Up
0
Down
This is my code kindly correct it and let me know errors...
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
PopupControlID="Panel1" OkControlID="Button2" TargetControlID="Panel1"
CancelControlID="Button3" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server">
<div>
<asp:Button ID="Button2" runat="server" Text="Button" />
<asp:Button ID="Button3" runat="server" Text="Button" />
</div>
</asp:Panel>
</div>

and in .cs page

if (!(Page.IsPostBack))
{
ModalPopupExtender1.Show();

}


Sathish Kumar S

Sathya4260, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response