Wednesday, July 15, 2009

input Checkbox or Radio button with runat server and checked property

Usually, when we actually don’t need of ASP.NET controls, we will use HTML control with runat="sever" for better processing. So, if you use the input checkbox/radio button control, it has the checked attribute, by default it look for the value "checked" for checked attribute in HTML. But because we made it server-side control by adding runat="sever" to it, it won't allow the "checked" value to "checked" attribute. The possible values for it is only True or False.

<input type="radio" runat="server" id="radioTech" checked="true" />

So, instead of "checked" value, use true or false.

No comments:

Post a Comment