Get the value from the CheckBox Control
35,600
Solution 1
You must get Value
attribute.
string Value = checkbox1.Attributes["Value"];
Solution 2
myCheckbox.Checked
returns true or false based on the state of the checkbox.
Solution 3
try this : ((CheckBox)(c)).Checked.ToString()
Author by
Asier Pomposo
Updated on April 05, 2020Comments
-
Asier Pomposo about 4 years
How can I get the value from the CheckBox Control before is selected?? It doesn´t have a .Value method.
else if (c.GetType() == typeof(CheckBox)) // c is control { string textValue= ((CheckBox)(c)).Text; // here I take the text string value= ((CheckBox)(c)).????; //how should I take the value?
-
Asier Pomposo almost 9 yearsit returns False value
-
Jamil almost 9 yearsWell this is what "value" means in checkbox.
-
Kram almost 9 yearsTry AutoPostBack="true" on your check box in the aspx
-
keypcb about 5 yearsYour checkbox control