prevent opening a new window in modal window using content page

Hi,

I have a content page with a button

and when I click it, I am trying to open a modal window

using javascript:showmodaldialog (this is a normal aspx page, I mean not a content page).

In the modal window. I have a asp button and when I click the button,I am trying to do some validation and the close the modal window.

what is h appening is, when I  click the button my code is executing and after that a webpage is opening again and the cotents which are in modal window are displayed in the webpage.

how to avoid this.

<cotent>

 <asp:button id="btn" text="xyz" runat="server"/>

</cotent>

button click code.

javascript:showmodaldialog('abc.aspx','win1');

my abc.aspx is not a cotent page.

it contains

<html>

<body><form>

<asp:button id="button1" runat="server" text="click" onclick="button1_click"/>

</form></body></html>

button click code of abc.aspx page.( here I am trying to close the modal window

StringBuilder sb= new StringBuilder();

sb.Append("<script language='javascript'>");

sb.Append("window.close();");

sb.Append("</script>");

this.ClientScript.RegisterStartupScript(this.GetType(), @"clientScript", sb.ToString());

when the code gets executed, it is opening a new page and trying to close that page but not closing the modal window.How should I close the modal window and prevent the opening of new webpage.

 

thanks

 

0
stevefaulk
8/24/2007 12:13:58 PM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

5 Replies
1408 Views

Similar Articles

[PageSpeed] 49
Get it on Google Play
Get it on Apple App Store

 Modal window's alway open a new window when you try to close it.

Write a blank webpage, and only place a iframe into it. and nest the webpage you actually open as a modal window in the iframe. Open the webpage with iframe instead opening the primary webpage. In short, place you webpage into a iframe.


Johnson
0
Johnson2007
8/28/2007 8:45:02 AM

Johnson2007:

 Modal window's alway open a new window when you try to close it.

Write a blank webpage, and only place a iframe into it. and nest the webpage you actually open as a modal window in the iframe. Open the webpage with iframe instead opening the primary webpage. In short, place you webpage into a iframe.

 Actually, not necessary. Just include the following tag in the head section of your HTML code:

 <base target=_self>


-pjm

I never gave a damn about the meterman until I was the man who had to read the meter.
0
pjmcb
10/22/2007 3:29:33 PM

Hi ,

 Can you help me on this issue I have two pages Parent.aspx and Child.aspx.

 In Parent.aspx I have gridview with list of reports when I click the the report link a modal window will be opened.

In the Modal window I have few field which it will get the parameters for the report to be generated. In the same modal window I have a  aspx button in which it will generate the reprot in the required format.

Actually what happening is the report is generated but it open an second window.

 I want to get rid of the second window. Also I am not able to close the Modal window after report is generated.

Waiting for the reply from anyone of u.

 

Thanks,

Abi.

0
abi_edh
7/9/2008 1:52:20 PM

See my response, above. Simply include that tag in the <HEAD> portion of your HTML, and all will be well...


-pjm

I never gave a damn about the meterman until I was the man who had to read the meter.
0
pjmcb
7/9/2008 2:03:30 PM

I have used that but not working I have a aspx button not HTML button

0
abi_edh
7/10/2008 9:03:48 AM
Reply:

Similar Artilces:

Prevent Mozilla firefox browser to block my popup window if i using page.clientscript.registerstartupscript to open new window
hi all ,          How can i prevent Mozilla firefox browser to  block my popup window if I using page.clientscript.registerstartupscript to open new window?   here are my code in my button . tjs = "window.open('" & "abc.aspx" & "?callpage=mainpage"   &   "','_blank','height=540,width=720,status=yes,toolbar=no,menubar=no,titlebar=no,location=no,resizable=no,scrollbars=yes' )"           &...

OPEN NEW WINDOW USING window.open
Hi, can any eagle eyed geniuses spot what I'm doing wrong here? It's doing my nut! I'm simply trying to call a new page in a new window that I want to control the size, etc. I've tried two different ways - one from within my code behind and the other triggered by a LinkButton command action. Both do absolutely nothing. Please help... Private Sub InfoClick1(ByVal pSiteCode) Response.Write("<script>window.open('siteinfo.aspx?sitecode='" & pSiteCode & "','Info','left=20,top=20,height=500,width=850,toolbar=no,status=no,resizable=1,scrollbars=no')</script>") End Sub +...

How to Opening New Window from Content Page Or Sub Page & Assigning the return value to the Content Page
I Have Master Page & Content Page. In Content Page I am able to open new Window, But after i select a value from the new window it is not flowing to the content pages Text box control. this code is working fine when i use an Ordinary Page, What about the Master/Content Page Can any one please help me out . thanks in Advance   Hi, Base on your description, you opened a new window in the content page and after you select a value from the new wondow, but you cannot  get the value in the textbox control, but this works fine in the ordinary page, right? In fact, if you use ...

window.modal vs window.open, which to use and how to use?
Hi, I am opening a child window through javascript with window.modal but the problem is when i click a button or link it opens another page with respect to that link, i want to open that page in same child window. when i used window.open the parameters like location scroll bar etc were made false but it had no effect on the child window, using window.modal is fine as far as these paremeters are concerned but the problem is same as i told you people earlier that it opens a third page. how to solve the problem thanx in advance I use modals a lot and they work well. Place <base...

Opening a new window in a new window using java script
I have an application where I need to open a new window and in that opened new window a button will be there clicking on which I have to open the other new window. I did in the normal way i.e, window.open('../NWINNW/FirstWindow.aspx','mywindow','width=730px,Height=290px,left=100px,top=100px,scrollbars=yes'); in the default page and window.open('../NWINNW/SecondWindow.aspx','mywindow','width=730px,Height=290px,left=100px,top=100px,scrollbars=yes'); in the first window page. The first opens correct but the second window is opening in the sa...

Calling parent window (using master page) button click event from an opened child window (not using master page)
I have a parent window that pops up a child window. In the child window, there is a server control LinkButton, with the following command at code-behind upon clicking:         Response.Write("<SCRIPT> javascript:window.opener.document.getElementById('<%=btnMas.ClientID%>').click(); </SCRIPT>");        Response.Write("<SCRIPT> javascript:window.close() </SCRIPT>");        Response.End(); What it would like to do are:1) Invoke the ...

How to open url in new window and use previous window when already opened
We can achieve this by using a simple javascript function....     var WindowObjectReference; function openRequestedSingleWindow(strUrl, strWindowName) {     if(WindowObjectReference == null || WindowObjectReference.closed)    {      WindowObjectReference = window.open(strUrl, strWindowName);    }    else    {      WindowObjectReference.focus();    } } Here we use a WindowObjectReference as a global variable to track the opened window. If opened for the fir...

automatically adjusting the new window size opened using window.open()
i am using window.open() javascript method specifying the height and width of the new window. but the problem is the contents are bit bigger than that, they will be invisible and if they are less, there will be blank white screen which doesn't look very good. so is it possible to adjust the size of new window automatically depending upon the content?-keeara g------------------ Hi keeara, Use window.resizeTo(iWidth, iHeight). Cheers, Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early. but can i access it by server side code? i am using vb.n...

how can I use window.opener but with window.showModalDialog instead of window.open
Hi, I tried the code bellow that I found in  :  4guysfromrolla site:the code displays a source page, whn I click on the Calendar <a href />  link  i get a calendar displayed on a target page. when I select a date, the calendar page closes and populates the textbox txtDate with the chosen date. Here is the code of the 2 pages and my question is down bellow:a source page called frmCalendar.aspx has this:<form name="frmCalendar">   <input name="txtDate" type="text" />   <a href=&q...

Problem with opening new window "window.Open" using javascript
I am trying to open new window when press a button "btnPrint" using: Response.Write("<script language='javascript'> window.open('CouponReport.aspx', 'window', 'HEIGHT=600,WIDTH=820,top=50,left=50,toolbar=yes,scrollbars=yes,resizable=yes'); </script>"); but when the new window opened the current page do a post back action and the current page format change like the following: before window open: after window opened: So, how i can a void the post back action.  <script language='javascript'> funct...

PDFS open in new window, used to open in FF window with URL showing
I don't recall changing anything except maybe the application Firefox is supposed to use for PDFs, from Adobe to Foxit Reader. If When I opened PDF files from the address bar I used to still have the address bar showing. This was handy for calling up IRS forms, then changing the "f" in the address bar to "i" to call up the instructions. Now, at least with Foxit Reader, it opens in a separate window without showing the actual URL downloaded in the Firefox address bar. It used to open in the same window as I recall, showing the address of the downloaded file. ...

Function lost : open home page in active windows instead opening a new window
Name: Michel Email: nebedjathotmaildotcom Product: Firefox Summary: Function lost : open home page in active windows instead opening a new window Comments: Now, when i hit my keyboard button to open a new firefox window, it go to the home page instead opening a new one, leaving my actual page. This function was usefull, i'm disappointed. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 From URL: http://hendrix.mozilla.org/ ...

Open a new window with window.open()
Hi, =20 in our web application, we try to open a popup-window with window.open(). But instead of opening a new window, a new tab is opened. =20 In the SeaMonkey preferences, we configured it, to open new links in a new tab. With firefox, we had the same preferences, but when window.open() was called, a new window was opened.=20 How can we configure SeaMonkey, so that it has the Firefox behavior when calling window.open() ? =20 Thanks in advance. =20 =20 =20 Artur Zeiler schrieb: > Hi, > > in our web application, we try to open a popup-window wi...

opening new window other than window.open
is there any other way of opening a new window... aside from window.open? window.open has a memory leak so i want to prevent using it as much as possible.Alvin ShihSoftware DeveloperMCP MCTS MCPD Hi window.showmodaldialog() but supports only IE....   Regards Suresh Kumar Goudampally Why dont you avoid pop up windows all together and use an iframe that is positioned over the content? Eric Pascarello.com | Twitter epascarello | LinkedIn Hi,Try Target="_blank" N.P.SenthilSoftware Engineer  Link buttons targer property is set to "_blank"...

Web resources about - prevent opening a new window in modal window using content page - asp.net.navigation-controls

Treaty to avoid or prevent Conflicts between the American States - Wikipedia, the free encyclopedia
The 1923 Pan American Treaty to avoid or prevent conflicts between the American States was signed at the Fifth International Conference of American ...

5 Reasons You Got Unfriended On Facebook (And How To Prevent It From Happening Again) - AllFacebook
Have you been loosing sleep trying to figure out why you got unfriended on Facebook? I hope not! But if you have been unfriended recently, you ...

In an upcoming column sure to shock many... - Brady Campaign to Prevent Gun Violence - Facebook
In an upcoming column sure to shock many of his readers, the editor of Guns & Ammo makes an argument for gun regulation. "I bring this up because ...

[...] Facebook Prevents Users From Sending Suspicious Friend Requests To Strangers, Inside Facebook [...] ...
Facebook has begun implementing new security measures to prevent friend request spamming. Some users are being shown a “This Request Can’t Be ...

HTTPS : Why can't websites turn everything into HTTPS to prevent firesheep from working?
Answer (1 of 6): While the cost for additional server computation is often cited, the much larger "cost" in the form of a performance hit comes ...

App Store - A Well-fixed Sheep Pen Prevents the Wolves-JoyOrange
Read reviews, get customer ratings, see screenshots, and learn more about A Well-fixed Sheep Pen Prevents the Wolves-JoyOrange on the App Store. ...

Bank of America security trying to prevent me from taking a photo during the Iraq war protest - Flickr ...
I started to take a photo of the Bank of America which had been closed because of the protest and they told me I wasn't allowed to. I explained ...

NORTHERN LEAGUE TRIES TO PREVENT ISLAMIZATION OF ITALY... - YouTube
..AND OF COURSE GETS BRANDED AS RACISTS & BIGOTS. COPYRIGHT DISCLAIMER UNDER SECTION 107 OF COPYRIGHT ACT OF 1976 ALLOWANCE IS MADE FOR 'FAIR ...

France tries to prevent collapse of fighter jet sale to India
An Indian committee that is looking into the deal has reportedly found that it was not the cheapest option.

Invention of the Day: New ‘Alternative’ Gun Attachment May Prevent Shooting Deaths
The Ferguson Police Department is testing out a new device which they think might help prevent unnecessary shooting deaths. “The Alternative” ...

Resources last updated: 12/25/2015 10:01:56 PM