473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
2 3380
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
2
by: msnews.microsoft.com | last post by:
It appears myButton_OnClick is triggering in my user control AFTER its parent's Page_Load already runs. Is there a way to make the parent Page_Load to run afterwards? I'm changing a session...
9
by: Chris | last post by:
I pop up a Modal form on a web page that allows the user to update the selections of a dropdownlist via adding a new item to the db (Sql Server).The only thing is this list is on the page beneath...
2
by: anil kumar via .NET 247 | last post by:
(Type your message here) hi, i am using save & cancel webform button my webpage to with somevalidations , when i am trying to save my content it is savedthat time i need a popup msg like ur 'data...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: John | last post by:
Hi, I posted this earlier in microsoft.public.dotnet.framework.aspnet, but didn't get a response, so I thought I'd try here. Basically, I'm having a problem opening / downloading csv files...
1
by: Curious Trigger | last post by:
Hi there, programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal dialog from Default.aspx. I searched the net and many newsgroups but I couldn't find any solution. First I...
9
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a...
0
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.