|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
December 14th, 2006, 02:27 PM
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
button click in modaldialog opens another browser
Hi,
I have a asp.net page with a asp:button and onclick of the button i am opening a modaldialog box and this modal dialogbox has another asp:button and upon clicking this button a new browser window is opened , which is weird, please do let me know on how i can handle this.
btnAddFamily.Attributes.Add("onclick", "window.showModalDialog('AddEditFamily.aspx',null, 'status:no;dialogWidth:752px;dialogHeight:460px;di alogHide:true;help:no;scroll:no');")
thank you
regards
sasi
thanks,
Sasidhar
__________________
thanks,
Sasidhar
|
December 14th, 2006, 03:09 PM
|
Friend of Wrox
|
|
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Whatis the code in the button that is in the modal dialog? If the code for that button makes a window.open call, for example, then a new window will be open.
Woody Z
http://www.learntoprogramnow.com
|
December 14th, 2006, 04:25 PM
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
there is no code in the button that is in the modal dialog, the new browser opens much before the onclick event
thanks,
Sasidhar
|
December 14th, 2006, 06:03 PM
|
Friend of Wrox
|
|
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I just have misunderstood your post as you said:
Quote:
quote:and this modal dialogbox has another asp:button and upon clicking this button
|
Then is your button in a form element? The button click will submit the form if that is the case.
You might try returning false from your onclick code:
Code:
btnAddFamily.Attributes.Add("onclick", "window.showModalDialog('AddEditFamily.aspx',null,'status:no;dialogWidth:752px;dialogHeight:460px;dialogHide:true;help:no;scroll:no');return false;")
Woody Z
http://www.learntoprogramnow.com
|
December 14th, 2006, 06:27 PM
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
but when i step through the code in debug mode the new browser is opened even before the onclick event is invoked.
thanks,
Sasidhar
|
December 14th, 2006, 06:32 PM
|
Friend of Wrox
|
|
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How are you stepping through javascript code running in a browser?
Is the modal dialog showing up at all?
Woody Z
http://www.learntoprogramnow.com
|
December 14th, 2006, 06:50 PM
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have a aspx page and it has button btnAddFamily and in the page load of this aspx page is the following line of code
btnAddFamily.Attributes.Add("onclick", "window.showModalDialog('AddEditFamily.aspx',null, 'status:no;dialogWidth:752px;dialogHeight:460px;di alogHide:true;help:no;scroll:no');return false;")
on click of this button a modal dialog box pops up with 'AddEditFamily.aspx and this has another button "Save" onclick of save I update the data from 'AddEditFamily.aspx' page to database , but before the onclick event of the save button is invoked another browser window is opened with 'AddEditFamily.aspx' loaded.
thanks,
Sasidhar
|
December 14th, 2006, 08:10 PM
|
Friend of Wrox
|
|
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Okay. I am unclear on this, but it is now my understanding that it is on click of the button on the MODAL DIALOG BOX that your problem is occuring and not your original window, so that is the code you need to show us. It sounds like you are posting back to that page from the modal dialog, and this is going to cause you trouble.
You might want to think about using an AJAX call to update the data.
Woody Z
http://www.learntoprogramnow.com
|
January 19th, 2007, 03:13 AM
|
Registered User
|
|
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sasidhar,
I am facing the same problem with the modal dialog.
When i click a button in a modal dialog, it is opening new browser window.
can you pls help me in how u have solved this problem.
|
January 24th, 2008, 03:59 AM
|
Registered User
|
|
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
just use <base id="base1" target="_self" /> on the page that you are opening in showModalDialog
Awais Usman Butt
|
|
|