473,487 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Poping up a window AND redirecting the page thtat triggered the po

Hi to all. I'm having trouble with the following situation:

I have a page where the user inserts some stuff and when he clicks on the
submit button a popup window showing that info is launched and the page "A"
where he was is redirected to another page, page "B". This page "B" can also
be accessed by other means. Can this be done? If so, how?

I was trying to do this:

protected void button_Click(object sender, EventArgs e)
{
string popupScript = String.Format("<script language='javascript'>" +
"window.open('ShowReport.ashx','CustomPopUp'," +
"'width=600, height=500, menubar=no, resizable=yes,
toolbar=no,
location=no, statusbar=no, left=212, top=184')</script>");

Page.RegisterStartupScript("ShowReport", popupScript);
Page.Response.Redirect("NewPage.aspx");
}
But what happens is that I get imediatly redirected to the NewPage.aspx. If
I'm not wrong, this happens because the current page isn't reloaded after
this event is treated. What I am asking is, for the effect I want (both the
pop-up and the redirect occurs) what can I do? I have also thought on trying
to open the pop-up on the loading of NewPage.aspx, by passing some specific
value when I make the redirect (something like
Response.Redirect("NewPage.aspx?popup=yes").
Any ideas/sugestions?

Thanks in advance

Dec 15 '05 #1
2 1678
Hi Ricardo,

The popup window must be generated on the client. This means that the page
must be loaded to generate the popup. What you can do is to have the page
pop up a window, and then submit back to the server, where the Redirect can
occur.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Ricardo Videira" <Ri************@discussions.microsoft.com> wrote in
message news:2A**********************************@microsof t.com...
Hi to all. I'm having trouble with the following situation:

I have a page where the user inserts some stuff and when he clicks on the
submit button a popup window showing that info is launched and the page
"A"
where he was is redirected to another page, page "B". This page "B" can
also
be accessed by other means. Can this be done? If so, how?

I was trying to do this:

protected void button_Click(object sender, EventArgs e)
{
string popupScript = String.Format("<script
language='javascript'>" +
"window.open('ShowReport.ashx','CustomPopUp'," +
"'width=600, height=500, menubar=no, resizable=yes,
toolbar=no,
location=no, statusbar=no, left=212, top=184')</script>");

Page.RegisterStartupScript("ShowReport", popupScript);
Page.Response.Redirect("NewPage.aspx");
}
But what happens is that I get imediatly redirected to the NewPage.aspx.
If
I'm not wrong, this happens because the current page isn't reloaded after
this event is treated. What I am asking is, for the effect I want (both
the
pop-up and the redirect occurs) what can I do? I have also thought on
trying
to open the pop-up on the loading of NewPage.aspx, by passing some
specific
value when I make the redirect (something like
Response.Redirect("NewPage.aspx?popup=yes").
Any ideas/sugestions?

Thanks in advance

Dec 15 '05 #2
if a page has a redirect header (produced by calling Redirect), the browser
will not render the html, if you want the html rendered, you need to use a
meta tag with a refresh. also popup blocks will prevent you popup window
anyway. you should change the button to a html hyperlink that opens the
report.
-- bruce (sqlwork.com)
"Ricardo Videira" <Ri************@discussions.microsoft.com> wrote in
message news:2A**********************************@microsof t.com...
Hi to all. I'm having trouble with the following situation:

I have a page where the user inserts some stuff and when he clicks on the
submit button a popup window showing that info is launched and the page
"A"
where he was is redirected to another page, page "B". This page "B" can
also
be accessed by other means. Can this be done? If so, how?

I was trying to do this:

protected void button_Click(object sender, EventArgs e)
{
string popupScript = String.Format("<script
language='javascript'>" +
"window.open('ShowReport.ashx','CustomPopUp'," +
"'width=600, height=500, menubar=no, resizable=yes,
toolbar=no,
location=no, statusbar=no, left=212, top=184')</script>");

Page.RegisterStartupScript("ShowReport", popupScript);
Page.Response.Redirect("NewPage.aspx");
}
But what happens is that I get imediatly redirected to the NewPage.aspx.
If
I'm not wrong, this happens because the current page isn't reloaded after
this event is treated. What I am asking is, for the effect I want (both
the
pop-up and the redirect occurs) what can I do? I have also thought on
trying
to open the pop-up on the loading of NewPage.aspx, by passing some
specific
value when I make the redirect (something like
Response.Redirect("NewPage.aspx?popup=yes").
Any ideas/sugestions?

Thanks in advance

Dec 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2081
by: Kiran | last post by:
Hi all, Can anybody let me know how to detect when my user clicks the X button on the window. I used unload event it did not work(on IE). My web page is a .asp page which reloads itself when...
2
14921
by: John Mack | last post by:
Intermittently I get the following error on Firefox: "Error: uncaught exception: Permission denied to get property HTMLDocument.window" What can cause this error? I do an image switch via JS...
5
1352
by: Buz Waitz | last post by:
I have tried several different versions of javascript to pop up a window from an aspx page. The problem is, that the new page pops up in the current window, not in a popup. The code works in a...
3
2450
by: tony | last post by:
I've been searching through the threads to find a solution for 401.3 error triggered by windows authentication not being able to redirect to a custom error page to no avail. It seems that ASP.NET...
5
3372
by: Mark | last post by:
Hi all, how do I open a javascript window from a code behind page? I was using Response.Write("<script language='javascript'>window.open('url','name','options');</script>") but now for some...
4
1314
by: Fernando Chilvarguer | last post by:
Hi, I've been trying to figure this one out for a while and I'm stalled. Here's my scenario: - a Parent window with a datagrid on it. The datagrid has pagination enabled and has an "Edit"...
1
3221
by: Kalyani | last post by:
Hi, I have a page with a button.On click of this button a popup window opens.Now if this window is kept open until session timeout then login page opens in the same window. Now I want that the...
2
1512
by: Kevin Frey | last post by:
We have a web application that, for the purposes of reporting, launches a new window to display the contents of the report in (PDF format). This is implemented using a custom IHttpHandler...
1
1408
by: runsrealfast | last post by:
I have a search page that will generate results at the bottom of the page. As part of the results each item will have a button that will open a window that will contain a more detailed view of the...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
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
7349
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...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.