How to open a url in a new tab or window for vb.net

casper114
casper114 used Ask the Experts™
on
I have created a new intranet module for my company, and on this module I have a link button that will redirect the user to a specific report on our report server. The user's intranet username that they use to log into the intranet is passed as a parameter in the URL. The link works great, but I'm trying to figure out how to get the URL to open either in a new tab, or a new window when the link button is clicked instead of opening in the same window. I have attached my subroutine from VS2008 below so you can see how I am presently doing this. The link has to be dynamic as the Employee parameter portion will be different for each user.
Protected Sub lbReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbReport.Click
        Dim Employee As String = Me.UserInfo.Username
        Dim URL As String = "http://ucliserver1/reportserver?%2fTime+Management%2fEmployee+Time+Management+by+Individual&rs:Command=Render&EmployeeName="
        Response.Redirect(URL + Employee)
    End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013

Commented:
Check this article:
http://dotnetslackers.com/articles/aspnet/javascript_with_asp_net_2_0_pages_part1.aspx#s6
Basically you need to use Page.RegisterStartupScript or if you are using ScriptManager on your page you can use ScriptManager.RegisterStartupScript
Also you can add attribute on page load for button on click event to call simple javascript function and pass whoel url as parameter to that javascript function.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial