By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page

P: n/a
Hi There,
I have a user control with buttons on it which I use on a aspx page
(parent page). On a button click, a modal dialog(aspx page) opens up
and the user enters some info in the modal dialog and clicks the save
button on it. The info is saved to the DB and the parent page is
refreshed. Everything works fine but for some reason the page load is
called twice. I have set the AutoEventWireUp = false on every page.
Also I have load event defined on the parent page and the child page
(which opens as a modal dialog). User control doesn't have any load
event defined. Can somebody help me please?
Thanks a lot.

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you're using a server control as the button to popup the modal
dialog, change it to just a plain html <button > tag.

If you need/want to keep the server control, put "return false;" at
the end of the javascript to prevent that button click from causing a
postback.

--
Jason Kendall
Ja**********@hotmail.com
On 11 Aug 2005 06:34:11 -0700, "Samy" <sa************@gmail.com>
wrote:
Hi There,
I have a user control with buttons on it which I use on a aspx page
(parent page). On a button click, a modal dialog(aspx page) opens up
and the user enters some info in the modal dialog and clicks the save
button on it. The info is saved to the DB and the parent page is
refreshed. Everything works fine but for some reason the page load is
called twice. I have set the AutoEventWireUp = false on every page.
Also I have load event defined on the parent page and the child page
(which opens as a modal dialog). User control doesn't have any load
event defined. Can somebody help me please?
Thanks a lot.

Nov 19 '05 #2

P: n/a
This is the code in the button click event handler...

StringBuilder strScript = new StringBuilder();
strScript.Append("<script language=JavaScript>");
strScript.Append("window.open('EditSavedProfile.as px','EditProfile','width=650px,height=450px,left=2 50px,top=80px','return
false');");
strScript.Append("</script> ");
Page.RegisterClientScriptBlock("subscribescript",s trScript.ToString()
);

But for some reason, the parent page loads twice....after the save
button of the modal dialog is clicked..Is there a syntax error or smth
else? I am unable to figure it out...
Can somebody help me?
Thanks.

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.