首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

CheckBox 的LabelAttributes属性的Add方法的参数有什么限定吗?解决办法

2012-04-03 
CheckBox的LabelAttributes属性的Add方法的参数有什么限定吗?CheckBox的LabelAttributes属性的Add方法可以

CheckBox 的LabelAttributes属性的Add方法的参数有什么限定吗?
CheckBox   的LabelAttributes属性的Add方法可以只给ChcekBox   的Text设置属性。msdn上add()定义如下:public   void   Add   (
string   key,
string   value
)
我想请问一下;参数有什么限制吗?比如key必须是浏览器能够识别的属性比如:OnMouseOver,Value必须是html语句?还是没有限制。
我用于测试的代码出现了问题?大家帮我看看?谢谢!


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

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<script   runat= "server ">
        void   Page_Load(object   sendre,   EventArgs   e)
        {
                CheckBox1.InputAttributes.Add( "OnMouseOver ",   "this.sytle.backgroundColor= 'red ' ");
                CheckBox1.LabelAttributes.Add( "onmouseout ",   "this.sytle.backgroundColor= 'white ' ");
        }
</script>
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> Untitled   Page </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
        <asp:CheckBox   ID= "CheckBox1 "   runat= "server "   TextAlign= "Left "   Text= "True "/>  
        </div>
        </form>
</body>
</html>

祝大家中秋快乐!

[解决办法]
LabelAttributes属性的Add
key可以自己随便定义了,不一定是特有的属性

热点排行