📜  ASP.Net标签

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

ASP.NET Web窗体标签

此控件用于在Web表单上显示文本信息。它主要用于为其他控件(如文本框)创建标题。

要创建标签,我们可以编写代码或使用Visual Studio 2017的拖放功能。

这是服务器端控件,asp提供了自己的标签来创建标签。下面给出示例。

< asp:LabelID="Label1" runat="server" Text="Label" >

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

Property Description
AccessKey It is used to set keyboard shortcut for the label.
TabIndex The tab order of the control.
BackColor It is used to set background color of the label.
BorderColor It is used to set border color of the label.
BorderWidth It is used to set width of border of the label.
Font It is used to set font for the label text.
ForeColor It is used to set color of the label text.
Text It is used to set text to be shown for the label.
ToolTip It displays the text when mouse is over the label.
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.

// WebControls.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebControls.aspx.cs" 
Inherits="WebFormsControlls.WebControls" %>



    
    


    

Provide the Following Details:

这是标签控件的属性窗口。

输出:

在这里,我们使用了带有两个不同控件的标签控件。它产生以下输出。