ASP.NET 的 WebControl.Attributes 属性

WebControl.Attributes 属性 


获取与控件的属性不对应的任意特性(只用于呈现)的集合。
[Visual Basic]
Public ReadOnly Property Attributes As AttributeCollection
[C#]
public AttributeCollection Attributes {get;}
[C++]
public: __property AttributeCollection* get_Attributes();
[JScript]
public function get Attributes() : AttributeCollection;


属性值
名称和值对的 System.Web.UI.AttributeCollection。


备注
Attributes 集合包含在 Web 服务器控件的开始标记中声明的所有属性的集合。这使您得以以编程方式控制与 Web 服务器控件关联的属性。您可以将属性添加到此集合或从此集合中移除属性。
注意   此属性用控件开始标记中集合中的所有属性来呈现,与浏览器设置无关。并非所有的浏览器都支持呈现的每个属性。不受支持的属性通常被浏览器忽略。


示例
[Visual Basic, C#, JScript] 下面的示例阐释当 TextBox 控件失去焦点时,可以如何使用 WebControl 的 Attributes 属性运行 Javascript 命令。
[Visual Basic]

<%@ Page Language="VB" AutoEventWireup="True" %>

 
 
   
 
 
 
   

Attributes Property of a Web Control


 

 
         Text="Click here and then tap out of this text box"
     runat="server"/> 
 
 
 
 
[C#]

<%@ Page Language="C#" AutoEventWireup="True" %>

 
 
   
 
 
 
   

Attributes Property of a Web Control


 

 
         Text="Click here and then tap out of this text box"
     runat="server"/> 
 
 
 
 

你可能感兴趣的:(asp.net,attributes,textbox,javascript,basic,server,Microsoft.NET)