There isn’t the attribute Value :
<asp:CheckBox ID="CheckBox1" runat="server" />
while on standard HTML this is allowed :
<input type="checkbox" ID="CheckBox1" value="My Valyue" />
why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
Textproperty is used to render a label for the checkbox.The control has an
InputAttributesproperty that you can add to:I believe that if you simply add the
valueattribute to the markup, this will also get populated.You can access the value like so:
To answer the question of why
Valueis not a build in attribute to theCheckBoxcontrol:A
CheckBoxin isolation (just by itself) needs no value. By definition it is a boolean and is identified by its ID. All you need to do is check whether it was checked or not.The value comes into play when you group checkboxes and there is a control for that – the
CheckBoxListthat usesListItem– eachListItemdoes have aValueproperty.