how can I add hyperlink to button?

G

Guest

I want a link button to perform two functions:

1. log off form authenticated user

2. navigate to another page

In the click event, I accomplished #1 with:
System.Web.Security.FormsAuthentication.SignOut().

What is code for the navigation?

Thanks.
 
K

Ken Cox [Microsoft MVP]

Hi Michael,

How about a Redirect?

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Response.Redirect("http://msdn.microsoft.com")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto
 
G

Guest

The link button is in the contents frame of a frameset. The URL to which I
redirect opens in that frame. I want it to open in a full page, i.e. as a
hyperlink can have "_parent" as a target. Any ideas?

Thanks!

Ken Cox said:
Hi Michael,

How about a Redirect?

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Response.Redirect("http://msdn.microsoft.com")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto

MichaelCaditz said:
I want a link button to perform two functions:

1. log off form authenticated user

2. navigate to another page

In the click event, I accomplished #1 with:
System.Web.Security.FormsAuthentication.SignOut().

What is code for the navigation?

Thanks.
 
K

Ken Cox [Microsoft MVP]

Hi Michael,

It's a bit of a hack, but I'd just jam in some Javascript to make it go to
the parent's frame:

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Page.RegisterStartupScript("redir", _
"<script>window.open('http://msdn.microsoft.com','_parent');</script>")
End Sub

Does that do it?

Ken
Microsoft MVP [ASP.NET]
Toronto

MichaelCaditz said:
The link button is in the contents frame of a frameset. The URL to which I
redirect opens in that frame. I want it to open in a full page, i.e. as a
hyperlink can have "_parent" as a target. Any ideas?

Thanks!

Ken Cox said:
Hi Michael,

How about a Redirect?

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Response.Redirect("http://msdn.microsoft.com")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto

message
I want a link button to perform two functions:

1. log off form authenticated user

2. navigate to another page

In the click event, I accomplished #1 with:
System.Web.Security.FormsAuthentication.SignOut().

What is code for the navigation?

Thanks.
 
G

Guest

That works! I appreciate your help.

I was surprised there wasn't a control which combines hyperlink with click
event in code behind page.

Michael

Ken Cox said:
Hi Michael,

It's a bit of a hack, but I'd just jam in some Javascript to make it go to
the parent's frame:

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Page.RegisterStartupScript("redir", _
"<script>window.open('http://msdn.microsoft.com','_parent');</script>")
End Sub

Does that do it?

Ken
Microsoft MVP [ASP.NET]
Toronto

MichaelCaditz said:
The link button is in the contents frame of a frameset. The URL to which I
redirect opens in that frame. I want it to open in a full page, i.e. as a
hyperlink can have "_parent" as a target. Any ideas?

Thanks!

Ken Cox said:
Hi Michael,

How about a Redirect?

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Response.Redirect("http://msdn.microsoft.com")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto

message
I want a link button to perform two functions:

1. log off form authenticated user

2. navigate to another page

In the click event, I accomplished #1 with:
System.Web.Security.FormsAuthentication.SignOut().

What is code for the navigation?

Thanks.
 
K

Ken Cox [Microsoft MVP]

Hi Michael,

Glad that works for you.

I'll have to check whether what you need is coming in ASP.NET 2.0.

Ken
Microsoft MVP [ASP.NET]
Toronto

MichaelCaditz said:
That works! I appreciate your help.

I was surprised there wasn't a control which combines hyperlink with click
event in code behind page.

Michael

Ken Cox said:
Hi Michael,

It's a bit of a hack, but I'd just jam in some Javascript to make it go
to
the parent's frame:

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Page.RegisterStartupScript("redir", _

"<script>window.open('http://msdn.microsoft.com','_parent');</script>")
End Sub

Does that do it?

Ken
Microsoft MVP [ASP.NET]
Toronto

message
The link button is in the contents frame of a frameset. The URL to
which I
redirect opens in that frame. I want it to open in a full page, i.e. as
a
hyperlink can have "_parent" as a target. Any ideas?

Thanks!

:

Hi Michael,

How about a Redirect?

Private Sub LinkButton3_Click _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButton3.Click
System.Web.Security.FormsAuthentication.SignOut()
Response.Redirect("http://msdn.microsoft.com")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto

message
I want a link button to perform two functions:

1. log off form authenticated user

2. navigate to another page

In the click event, I accomplished #1 with:
System.Web.Security.FormsAuthentication.SignOut().

What is code for the navigation?

Thanks.
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top