C# - Response Redirect - Open Link In New Window
Apr 14, 2010
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?
View 1 Replies
Similar Messages:
Aug 24, 2010
I need to open a new window with Response.Redirect, Is it possible?
View 2 Replies
Oct 9, 2010
I 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());
View 14 Replies
Feb 13, 2010
how can i redirect to other page from pop up window with response.redirect.
View 2 Replies
Aug 2, 2010
I am trying to open a file share link from the window.open ... but its adding the http://localhost/vdir/ before the path can any one say what is the problem?
View 1 Replies
Aug 31, 2010
protected void ddlPrint_Changed(object sender, EventArgs e)
View 4 Replies
Mar 24, 2011
I 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]....
View 8 Replies
Jan 10, 2010
How can do response.redirect to a new window without javasript? I also have a masterpage.
View 8 Replies
Oct 22, 2010
I 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?
View 3 Replies
Sep 15, 2010
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]....
View 3 Replies
Sep 18, 2010
I have a button which redirects the user to another page. Instead, I would like this button to open a new window that points to this location.
aspx:
<asp:ImageButton ID="img_url"
CommandName='<%#Eval("url") %>'
OnClick="img_url_Click"
runat="server"
ImageUrl="~/images/products_details.png"
/>
cs:
protected void img_url_Click(object sender, ImageClickEventArgs e)
{
ImageButton img = sender as ImageButton;
Response.Redirect(img.CommandName.ToString());
}
View 3 Replies
Sep 23, 2012
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]...
View 1 Replies
Aug 31, 2010
I'm using the following span to open a page in a new window. What is INCREDIBLY odd is that it is exactly the same code from three different pages, but the first refuses to open in a new window. The only difference is that the first example resides within an Ajax Accordian Panel so I suspect that it might be an Ajax related issue.
[Code]....
View 2 Replies
Mar 16, 2011
i have a string(including a link) comes from database, and i am assigning it to a label, now i want open it in parent window whenever i click on it, the string consists following code,
log on to <a href='http://mySiteName/Login.aspx'> PAS</a> at your earliest convenience. By the way, you are doing a great job.
View 1 Replies
May 7, 2015
I am using an asp:button to open a url link :
protected void redirectTo_OnClick(object sender, EventArgs e) {
Response.Redirect("http://www.google.com");
}
This link open itself in its own window , i want it to be opened in other window just link we do in html
< a href="google.com" target="_blank"></a>
How to do this in c# ?
View 1 Replies
Jul 7, 2010
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?
View 4 Replies
May 10, 2010
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 Replies
Feb 9, 2010
I am trying to navigate it to another page using Link Button and in the .cs file, I am using Response.Redirect. But I want it to the open in a new window.
The reason why I cant use hyperlink is I cant use Command Arg and Command Name which I am using in the Link Button.
I tried the below Javascript, But it's coming as a pop up for the first time when it loads. I don't want it in that way also.
Is there a way like Hyperlink '_blank'.
public static void OpenNewWindow(string url, Page thispage)
{
string fullURL = "window.open('" + url + "', '_blank', 'fullscreen = no, status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,titlebar=yes' );";
ScriptManager.RegisterStartupScript(thispage, typeof(string), "OPEN_WINDOW", fullURL, true);
}
.cs
<asp:LinkButton ID="lbtn_photo" runat="server" Text="Upload Photo"
OnClick="Upload_Photo"></asp:LinkButton>
protected void Upload_Photo(object sender, EventArgs e)
{
Response.Redirect("UpPhoto.aspx?id=" + Request.QueryString["id"]);
}
View 8 Replies
Jan 7, 2011
I am sending mail using .net c# code. In that mail i am providing link of customer website. When anyone click on link (in outlook mail) then it will open new window if already not opened any window. Suppose user already working in IE browser [URL] and then user click on link using outlook mail then link open in new tab in already opened IE browser window. So i want that everytime open new browser window when click on link.
View 4 Replies
May 3, 2010
I 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?
View 1 Replies
Oct 26, 2010
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 Replies
Sep 27, 2010
I was trying to open a new window when a link button is clicked.
<asp:LinkButton ID="lnkpackageinfo" CssClass="linkclass"
runat="Server"
OnClientClick="lnkpackageinfo_Click()">Compare Packages</asp:LinkButton>
I want the target page to be given in the code behind because in the target page i want to use querystring to hide few buttons and links. It is clear
protected void lnkpackageinfo_Click(object sender, EventArgs e)
{
long MerchantID = CommonHelper.GetLoggedInMerchant();
string querystringpackageinfo = ApplicationData.URL_MERCHANT_COMPANY_PACKAGE + "?MerchantCompanyPayment";
Response.Redirect(querystringpackageinfo, false);
}
View 3 Replies
Apr 27, 2010
i have stored the txtfile in the database.i need to show the txtfile when i clik the link. and this link has to be created dynamically.
my code below:
aspx code:
[code]....
i have got the link dynamically, but i did not able to download the txtfile when i clik the link. how to carry out this.
View 2 Replies
Jun 26, 2012
i have gridview with link button.. if i click on link button to open new window with pdf file.
View 1 Replies
Jan 26, 2010
I know this is probably a pretty normal pattern, but, I've never had to code it up. I'm using a GridView to display various items from a SQL query. I can do this without any problems. Upon selecting a specific item, I want to open a new page based on the selected row item link that passes some parameters to a SQLDataSource in the newly spawned window. I know I can use the javascript window.open function() to create a new window, but, I don't know how to pass the desired code to this new window.
View 1 Replies