How To Open A New Window With Response.Redirect
Aug 24, 2010I need to open a new window with Response.Redirect, Is it possible?
View 2 RepliesI need to open a new window with Response.Redirect, Is it possible?
View 2 RepliesI am working on a C# .net application in which I need to open a new browser and direct users to it in the event they click on a button or image.
i want to keep the main page and opens a new window browser once the user click the button.
here's my code.
aspx page.
<asp:Button ID="previewbtn" runat="server" Text="PREVIEW " OnClick="previewbtn_Click" />
code behind:
Response.Redirect("newpage.aspx?bg=" + Session["user"].ToString() + "&dc=" + Session["dcode"].ToString());
First, I've taken the time to review this question which seems to be the most similar, however, the solution that seems to have been selected will not work in my scenario.Not to mention I worry about some of the comments claiming it to be brittle or an inadequate solution.
[URL]
-We have an XML document which basically contains all of the information for a Side menu.
-We have numerous URLS which are stored in a constants class.
-One of the elements in a string of XML (well call it label) is used to determine if the menu item is created as a LinkButton or a Label.
-Links use a custom user control that is used standard for all links across the application (why suggestion on similar thread doesn't work - I don't want all links to open in a new window - just one)
-One of the elements in a string of XML (well call it function) is used in a Switch statement to generate our links using Response Redirect.
It may look something like this.
[Code]....
Given this scenario, I'm trying to find the best way to quickly open a New Window, when a specific case in this switch statement is met. Can it be done with Response Redirect (this seems to be arguable - people say no it can't, yet other people say they have made it work)? If not, what alternative can work here?
how can i redirect to other page from pop up window with response.redirect.
View 2 Repliesprotected void ddlPrint_Changed(object sender, EventArgs e)
View 4 RepliesI have an query when user select any option it should redirect and open new tab in same browser, actually it worked fine in firefox and IE but in chrome it opens a new window. Below is the code.
[Code]....
How can do response.redirect to a new window without javasript? I also have a masterpage.
View 8 RepliesI know this has been asked many times and have saw the posts that it cant be done and there are alternative solutions.
The caveat is that after clicking on the button this will load a new page with the target URL but I would want the current web form to remain as it is. That is essentailly two web forms side by side?
I have a button that when clicked on it will open a pdf file in the current window. Can someone help me modify my code to open in a new window? Here's what I have so far that works when the button is clicked:
[Code]....
I have 1 textbox and 1 button in my page..when users type their user name in text box they go to their page these are my code
<div id="behcode">
<div id="divbehcodebtn">
<asp:ImageButton ID="ImageButton3" runat="server" CssClass="imgbtnbehcode"
[code]...
rl711
You have to use target attribute in form tag:
<form runat=server target=_blank> // new window
or
<form runat=server target=_top> // above all frames
or
<form runat=server target=_parent> //parent frame
or
<form runat=server target=someframe> // a frame by name
This can only work if the Server.Transfer is invoked from within the form such as a button click.
If your Server.Transfer method is in the Page_load event (which isn't a form event), how do you set a target window to Server.Transfer?
How can I make a Response.Redirect open in a new page? I guess it would be the ASP.NET equivalent of <a href="page.aspx" target="_blank">click here</a>. I have a lot of code on an OnClick event handler and it redirects at the end of the code. It would make it very simple if there was a way to do it in ASP.NET.
View 5 RepliesI was wondering how a page can keep the Accordion from refreshing it's selected index in a postback or when redirecting to itself. I wanted it to keep the index value of the last open page and somehow coax the accordion to have that open instead.
How would I go about that?
I have a page that creates a pdf and opens the pdf. I use response.write with javascript using window.open to make the window open with the pdf, works fine. I then want the main window to do a redirect to a message page. But soon as I add code to do that (either more javascript using location.href or response.redirect, it does that but the window.open no longer works. It's like it's running the redirect before it really has a chance to finish the window.open. Is there a better way (a way that works LOL) to accomplish this?
View 2 RepliesHere is the website situation:
Webpage A: look & feel alignments are in the central of the screen. It has a submit button. The last code in the submit command() is this message subject:
Response.Write(string.Format("<script>window.open('{0}', '_blank');</script>", url));
where url = another webpage B.The outcome is fine. Webpage B is populated properly. However, Webpage A postback as aligment to the left, it is no longer the center. I could not find a way to debug the issue.
So I understand that the HperLink is a Client Side Control but I need code behind so that I can store the click event in the database. If I use the Link button, I have the opposite issue where I can access the client side but cannot open the url since this control does not have the NavigateUrl attribute.
<asp:HyperLink ID="hlnkCompanyName" runat="server" NavigateUrl='<%# Eval("CompanyAdRedirectURL") %>'
i have an aspx page in which a link in the grid view opens a popup page . the data in the grid view would be dynamic and i need to send the id of the row of grid while calling the child window. i get the id using sender.id, but how would i send this using window .open()?
View 2 Replieswhich one is better response.redirect or postbackurl(asp:button feture) to redirect web page?
View 3 RepliesI want to redirect to "~/City/Göteborg", but if I just write Response.Redirect("~/City/Göteborg"); I will end up with an ugly URL in the address-bar like this: http://www.mysite.com/City/G%c3%b6teborg..
So my question is how to redirect to obtain a clean url like http://www.mysite.com/City/Göteborg?
I have a problem with Response.Redirect to specific error page.
so far i have something like :
protected void Page_Load(object sender, EventArgs e)
{
if ((Request.QueryString["UbytovaniePrispevokID"].ToString()) == "")[code]......
What i want to do is.. I have one main page with new posts Each subject of the new post is the link to Another page where is Specific post and coments and user can leave a coment.
What I want is when the Request.QueryString["UbytovaniePrispevokID"].ToString()) == "" or null I want to redirect to error page ...
I have a login page that is loaded in popup window (colorbox) and after user logs in it should be closed and parent window should be loaded with new page.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Do While reader.Read()
If Trim(reader("ZAP").ToString()) = Trim(textBoxZap.Text) Then
Session("A") = "1"
Response.Redirect("~/default.aspx")
Else
lblErr.Text = "incorect"
End If
Loop
So once the buton is clicked and user name and password is corect popup window should be closed and user redirected to default aspx.
I am trying to open a popup window from main window using window.open() method. How to get back the value from the called popup window to the calling window in vb.net, basically i need to get back the value and populate in the text box available in the main window.
View 3 Replieswe are running a click-to-call service, my idea is basically like this: website have a link on their page, when the link is clicked, a web page(say it is popup.aspx) hosted on our server is popup, user can input their phone number, and click "call me" button to let the website call him. In the button click event, I want to get Request.UrlReferrer, then query the db to get website's phone. But in IE, Request.UrlReferrer is null(firefox is ok, not test chrome yet),my question is how to get opening window' url in IE? we put popup.aspx on our server because
our client website is not force to use asp.net. we have the control what we put on the popup window, and can modify the page just from our side, if we put the pop window on our partner's side, if we have 100 partner, and we change the page's design, we will notify everyone of them to change this, change that. we can implement a statics system to know how popup a day, which site is most popular,etc
I am using the javascript to open a child window using window.showModaldialog(), i have retuen a value from the child page is working fine in IE and firefox but is not working in chrome browser, is there any work around or alternative for it to work in chrome as well.
View 2 RepliesI have an asp.net page that contains an Iframe embedded with some data and a ImageButton. On ImageButton click event (server side) I have Response.Redirct:
Response.Redirect("results.aspx");
This always open the results.aspx in iframe. I want that results.aspx should always open in the parent window. I tried the following till now but none worked:
Response.Redirect("<script language='javascript'>self.parent.location='results.aspx';</script>");
Response.Redirect("javascript:parent.change_parent_url('results.aspx');");
..and also tried the options from [URL]