Getting checkboxes values

Results 1 to 2 of 2

Thread: Getting checkboxes values

  1. #1
    Join Date
    Dec 1969

    Default Getting checkboxes values

    I have 5 checkboxes in my GUI named C1,C2,C3,C4 and C5.Depending on which checkbox the user has selected, I included a form post method in my program to check whether each of the checkbox is checked.Can i do something like this in my code behind page?<BR><BR>&#060;coding&#062;<BR> Chk1 = Request.Form["C1"];<BR><BR> if (Chk1.checked)<BR> {<BR> //do something<BR> } <BR>&#060;/coding&#062;

  2. #2
    Join Date
    Dec 1969

    Default no, that wont work

    because in the line you have:<BR>[code language="VB.NET"]if (Chk1.checked)[/code]<BR><BR>the code has absolutely no idea that Chk1 is a Checkbox control...<BR><BR>if they are &#060;asp;checkbox&#062; control&#039;s, you&#039;d just cast the control "C1" to type checkbox, THEN you can ask the above "if checked" question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts