添加自定义属性到一个asp:CheckBox控件 [英] Adding custom attributes to an asp:CheckBox control

查看:443
本文介绍了添加自定义属性到一个asp:CheckBox控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义数据要求的属性添加到一个asp复选框控件,它工作正常,因为我已经用它的所有其他控件,但在checkboxs它呈现具有自定义属性上的跨度内的复选框。我尝试添加了标记属性,并试图将其添加到背后的code中的控制。任何想法?

I am trying to add a custom data-required attribute to an asp Checkbox control, it works fine for all other controls I've used it on, but on checkboxs it renders the checkbox inside a span that has the custom attribute on. I've tried adding the attribute in the markup and tried adding it to the control in the code behind. Any ideas?

推荐答案

使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.inputattributes.aspx\">InputAttributes

这篇关于添加自定义属性到一个asp:CheckBox控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆