span is getting added with AspNetDisabled class in sample application. but not in our project if we disable the control
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.
精彩评论