当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Web服务器控件:Label控件

ASP.NET
ASP.NET入门教程:ArrayList对象
ASP.NET入门教程:Hashtable对象
ASP.NET入门教程:SortedList对象
ASP.NET入门教程:把XML文件绑定到列表控件
ASP.NET入门教程:Repeater控件
ASP.NET入门教程:DataList控件
ASP.NET入门教程:数据库连接
ASP.NET入门教程:ASP.NET 2.0新特性
ASP.NET入门教程:ASP.NET 2.0母版页
ASP.NET入门教程:ASP.NET 2.0导航
ASP.NET入门教程:HTML服务器控件
ASP.NET入门教程:Web服务器控件
ASP.NET入门教程:Validation服务器控件
HTML服务器控件介绍:HtmlAnchor控件
HTML服务器控件介绍:HtmlButton控件
HTML服务器控件介绍:HtmlForm控件
HTML服务器控件介绍:HtmlGeneric控件
HTML服务器控件介绍:HtmlImage控件
HTML服务器控件介绍:HtmlInputButton控件
HTML服务器控件介绍:HtmlInputCheckBox控件

ASP.NET 中的 Web服务器控件:Label控件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 45 ::
收藏到网摘: n/a

阅读此文请先查看:ASP.NET入门教程:Web服务器控件,简单讲述了Web服务器控件的使用方法。

定义和用法

Label 控件用于在页面上显示文本。该文本是可编程的。

注释:该控件允许您为内容应用样式!

属性

属性 描述
runat 规定该控件是一个服务器控件。必须设置为 "server"。
Text 在 label 中显示的文本。

Web 控件标准属性

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth,
CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled,
SkinID, Style, TabIndex, ToolTip, Width

控件标准属性

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls,
EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site,
TemplateControl, TemplateSourceDirectory, UniqueID, Visible

语法

<ASP:Label 
Id="控件名称" 
Runat="Server"
Text="控件上要显示的文字"
/> 本文来源于RuanChen

<ASP:Label 
Id="控件名称" 
Runat="Server"
>
所要显示的文字
</ASP:Label>

实例

 <% Page Language=C#>
<Html>
<script runat=server>
void Page_Load(object sender, System.EventArgs e)
{
 Label1.Text="这是一个Label控件";
}
</script>
<body>
<ASP:Label id="Label1" Runat="Server" />
</body>
</Html>