Opening the link on new tab?

Opening new tab using a link with querystring variable?

  • First of all, I am entirely new to web development, so I apologize in advance if this question is overly simple (although I did do the prerequisite googling before I posted). The problem I am having is that I would like to open a new tab via a link button or link on my page. I need to append a query string variable from the page onto the end of the reference, because it is passing a parameter to a report. I've successfully passed the parameter and opened the report in the same tab using this code: protected void lbSummary_OnClick(object sender, CommandEventArgs e) { Response.Redirect("http://myreportserverURL&rs:Command=Render&Year="+YearID); } And I've successfully opened the report in a new tab without passing the parameter with this code: <a href="http://myreportserverURL" target="_blank" class="menu">Report Name</a> I would prefer to do both. One important note is that opening a new window, instead of a new tab, is not what I need. I do understand that this is somewhat dependant on browser use, but for this project I can assume that users will be on IE8. Is this possible? Any suggestions would be greatly appreciated.

  • Answer:

    You can use asp.net http://msdn.microsoft.com/en-US/library/system.web.ui.webcontrols.hyperlink_properties%28v=VS.80%29.aspx where you can set it's NavigateUrl in code-behind to whatever link you want including your querystring in there. You can set it's Target Property as per you need.

badpanda at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Set target="_tab" this will open link in new tab

Akash Kava

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.