📜  ASP.Net超链接

📅  最后修改于: 2020-12-27 13:29:36             🧑  作者: Mango

ASP.NET Web窗体超链接

它是用于创建超链接的控件。它响应单击事件。我们可以使用它来引用服务器上的任何网页。

要创建HyperLink ,我们可以编写代码或使用Visual Studio IDE的拖放功能。该控件在工具箱中列出。

这是一个服务器端控件,ASP.NET提供了自己的标签来创建它。下面给出示例。

< asp:HyperLinkID="HyperLink1" runat="server" Text="JavaTpoint" NavigateUrl="www.javatpoint.com" >

服务器将其呈现为HTML控件,并向浏览器生成以下代码。

该控件具有自己的属性,如下表所示。

Property Description
AccessKey It is used to set keyboard shortcut for the control.
TabIndex The tab order of the control.
BackColor It is used to set background color of the control.
BorderColor It is used to set border color of the control.
BorderWidth It is used to set width of border of the control.
Font It is used to set font for the control text.
ForeColor It is used to set color of the control text.
Text It is used to set text to be shown for the control.
ToolTip It displays the text when mouse is over the control.
Visible To set visibility of control on the form.
Height It is used to set height of the control.
Width It is used to set width of the control.
NavigateUrl It is used to set navigate URL.
Target Target frame for the navigate url.

// user-form.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user-form.aspx.cs" 
Inherits="asp.netexample.user_form" %>



    


    

此属性窗口显示HyperLink控件的属性。

输出:

该链接重定向到Javatpoint主页。