It may be simple but the search words in Google give too many irrelevant results.
Protected Sub Menu1_MenuItemClick(sender As Object, e As MenuEventArgs) Handles Menu1.MenuItemClick
If e.Item.Text = "SomeItem" Then
'The link goes here
End If
End Sub
Aryan Kumar
06-Jul-2023Sure, I can help you with that. Here are the steps on how to create a link to website in vb code behind:
VB.Net
Here is an explanation of the code:
New
keyword is used to create a new Hyperlink object.NavigateUrl
property of the Hyperlink object is set to the URL of the website that you want to link to.Text
property of the Hyperlink object is set to the text that you want to display for the hyperlink.Controls.Add
method is used to add the hyperlink to the form.Anonymous User
14-Apr-2015Use Response.Redirect if you want to send the current page to a new url:
To open a new url in a new window/tab you would have to use javascript. Normally I would recommend just putting the javascript directly onto the aspx page but in the event that the url will use data from the code behind to generate the url you can use the ClientScript.RegisterStartupScript function.