Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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
 
Old December 14th, 2006, 02:27 PM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default 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
 
Old December 14th, 2006, 03:09 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old December 14th, 2006, 04:25 PM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default

there is no code in the button that is in the modal dialog, the new browser opens much before the onclick event

thanks,
Sasidhar
 
Old December 14th, 2006, 06:03 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old December 14th, 2006, 06:27 PM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default

but when i step through the code in debug mode the new browser is opened even before the onclick event is invoked.

thanks,
Sasidhar
 
Old December 14th, 2006, 06:32 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old December 14th, 2006, 06:50 PM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default

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
 
Old December 14th, 2006, 08:10 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old January 19th, 2007, 03:13 AM
Registered User
 
Join Date: Jan 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old January 24th, 2008, 03:59 AM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to awaisusmanbutt Send a message via Yahoo to awaisusmanbutt
Default

just use <base id="base1" target="_self" /> on the page that you are opening in showModalDialog

Awais Usman Butt





Similar Threads
Thread Thread Starter Forum Replies Last Post
disable browser right click?? danielnixon HTML Code Clinic 1 May 19th, 2008 12:11 PM
Button that opens an image comicghozt Access 6 June 3rd, 2006 02:29 AM
Handle Sessin in browser cross button click ashish2001mca General .NET 1 February 9th, 2006 10:28 AM
Button Click ~Bean~ ASP.NET 1.0 and 1.1 Basics 2 September 27th, 2005 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.