开发者

span is getting added with AspNetDisabled class in sample application. but not in our project if we disable the control

开发者 https://www.devze.com 2023-03-04 18:20 出处:网络
开发者_StackOverflow中文版In my Project, <span disabled=\"disabled\"> <input id=\"_ctl0_ContentHolderArea_CheckBox1\" type=\"checkbox\" name=\"_ctl0:ContentHolderArea:CheckBox1\" disabled=\"
开发者_StackOverflow中文版

In my Project,

<span disabled="disabled">
<input id="_ctl0_ContentHolderArea_CheckBox1" type="checkbox" name="_ctl0:ContentHolderArea:CheckBox1" disabled="disabled" />
</span>

In Sample,

<span class="aspNetDisabled">
<input id="CheckBox1" type="checkbox" name="CheckBox1" disabled="disabled" />
</span>


Are you using Framework 4.0? XHTML standards say that only Input types can have a Diasbled parameter (even though it works in most browsers) - so in 4.0 M$ changed the HTML rendering for non-Input tags to use the aspNetDisabled class instead (actaully as well in many cases). If you compile against 3.5 or earlier, you will not get the new class.

Note that there is a .InputAttributes.Add command to (which stops the HTML rendering still putting the Disabled=Disabled parameter out) which can be used for checkboxes and radio buttons instead of Attributes.Add for adding disabled attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号