Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

Open a page in asp.net

How can I pass my value to below link to open a page?

 Public Class MyLink
        Inherits HyperLink
        Public Sub New(ByVal text As String, ByVal values As String)
            MyBase.New()
            Me.Text = text
            NavigateUrl = "window.open( 'http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=<%# '" & myvalue & "' %>','_blank' ,'status=yes,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,height=800,width=980,location=no' );"

        End Sub
    End Class
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

NavigateUrl = "window.open( 'http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=<%# '" & myvalue & "' %>','_blank' ,'status=yes,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,height=800,width=980,location=no' );"
That's javascript, not ASP.  While you can pass a value to it, it has to be placed in a javascript block on the page.  If you put it on the page where it will automatically open, it will probably be blocked by the browser's pop-up blocker.
Avatar of VBdotnet2005

ASKER

This page is for intranet only (inside the company).
This works just fine. However, I just want it to pop up instead of open a new tab.

Public Class MyLink
        Inherits HyperLink
        Public Sub New(ByVal text As String)
            MyBase.New()
            Me.Text = text
            NavigateUrl = "https://www.google.ru/search?q=" & text

        End Sub
    End Class
Doesn't change anything I said.  If the pop-up blocker is on, you won't see an 'automatic' pop-up because that is what they are designed to block.  Pop-ups that come up because the user clicked on something are allowed.  

And you still can't use a javascript 'window.open' in that statement.  Javascript only runs in the browser and that line is ASP that is run at the server.
I just want to open a new page from my links. What would the javascript look like?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Dave
You're welcome, glad to help.