Search
Author
ASP.NET Tutorials
Author
Sheo Narayan
Advertisements


Winners

Win Prizes

Social Presence
Like us on Facebook

Silverlight Tutorials | Report a Bug in the Tutorial
asp:Hyperlink control
Hyperlink control is used to jump to another location or to execute the script code.
 
Hyperlink control is used to jump to another location or to execute the script code. When rendered on the page, it implements an anchor <a/> tag.

Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <a/> tag. You can set its Text either by setting Text property in the .aspx page or from server side page. (other properties can also be set from both pages)

Following are some important properties that are useful.
NavigateUrl Used to specify the location to jump to.
ImageUrl Used to place an image instead of text as Hyperlink.
DEMO : Hyperlink Show Source Code
Location wtih link as Text Go to Button Control tutorial Location with link as Image
  Location with Confirmation box Go to Button Control tutorial
                    // location with link as Text
                    <asp:HyperLink ID="HyperLink1" runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx" />
                    
                    // location with link as Image
                    <asp:HyperLink ID="HyperLink2" runat="Server" NavigateUrl="~/tutorials/controls/imagebutton.aspx" ImageUrl="~/images/demobutton.gif" ToolTip="Go to ImageButton control tutorial" />
                    
                    // Location wth Confirmation box
                    <span onclick="return confirm('Are you sure to proceed?')">
                        <asp:HyperLink ID="HyperLink2" runat="Server" Text="Go to Button Control tutorial" NavigateUrl="~/tutorials/controls/button.aspx" />
                    </span>