Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Parse Checkbox Input Type Value to String

Status
Not open for further replies.

yaknowss

Programmer
Apr 19, 2012
69
0
0
US
I currently have this functionality in place for a decimal value, but I also need it for a checkbox. Below is what I have for the decimal value, how can I replicate this for my check box value?

Code:
if (decimal.TryParse(txtGift.Value.ToString().Replace("$", ""), out number))//93
            {
                addItemToCart("Gift of ", number);
                addDonations(number, 93);
                addOnTotal = addOnTotal + number;
            }
 
In reagrd to an asp.Net control, A checkbox doesn't really have a 'value'. It has a 'Text' property, which is the textual value displayed describing the purpose or meaning of the checkbox, (i.e., Please uncheck if you do not wish to receive marketing from us in the future), and a 'Checked' property which is a boolean.

If you're working with an Html control I believe the 'value' is the equivalent of the 'Text' property, (see above), so are you really looking for the value of the 'checked' property of an Html checkbox control?

Rhys

"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top