executing a hyperlink

G

G. Dean Blake

I have a hyperlink on my aspx page added at dev time. Is there a way to
execute it from code?
Thanks,
G
 
J

John Hann

G. Dean Blake said:
I have a hyperlink on my aspx page added at dev time. Is there a way to
execute it from code?
Thanks,
G

Response.Redirect( <yourLinkHere> );
 
G

G. Dean Blake

"it" means the hyperlink control on my page(which has target='_new'), not
just a url.
 
J

John Hann

G. Dean Blake said:
"it" means the hyperlink control on my page(which has target='_new'), not
just a url.

In that case, I'm not quite sure what you're trying to accomplish.
"_new" does not have a special meaning as a value for the Target
property, so I doubt that will affect the behavior of your HyperLink.
And you're trying to "execute" it from code, does that mean redirect the
browser to the NavigateURL of the HyperLink? If you want to do that, try
this
Reponse.Redirect(yourHyperLink.NavigateURL);
If that's not what you intend to do, please be more specific.
- John
 
G

G. Dean Blake

What I am trying to do is....

I want to switch to Page2.aspx using a response.redirect but I want
Page2.aspx to display in a New Browser Window. If I simply execute
response.redirect(page2.aspx) it will display in the same browser window.

If I have a hyperlink added at design time and specify '_new' in the target
property it will pop up a new window when that hyperlink is clicked by the
user. But if I try to execute that hyperlink from code by doing
response.redirect(myHyperlink.NavigateURL) it simply uses that string and
doesn't really execute the hyperlink in the web page (that has Target='_new'
in it).
G
 
J

John Hann

G. Dean Blake said:
What I am trying to do is....

I want to switch to Page2.aspx using a response.redirect but I want
Page2.aspx to display in a New Browser Window. If I simply execute
response.redirect(page2.aspx) it will display in the same browser window.

If I have a hyperlink added at design time and specify '_new' in the target
property it will pop up a new window when that hyperlink is clicked by the
user. But if I try to execute that hyperlink from code by doing
response.redirect(myHyperlink.NavigateURL) it simply uses that string and
doesn't really execute the hyperlink in the web page (that has Target='_new'
in it).
G

Ok, now I understand. I don't know if you can get the behavior you're
looking for without a hack. Here's what I've done when faced with the
same problem. Write an onload javascript function for your page's body
element. That onload function should check an hidden HTML input for a
URL value and, if one is found, popup a window with that URL in it. That
hidden variable should also have "runat=server" specified. When you want
to popup the window from server-side code, set the hidden form variable
to the url you want to popup, and the onload function will do the dirty
work for you.
- John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to keep the order of executing tasks? - Help needed. 1
HyperLink 1
hyperlink 2
HyperLink Bug 20
Executing a program 6
HyperLink trouble 2
changing hyperlinks in code 0
HyperLink from GridView 7

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top