HtmlInputCheckBox Control question....

Results 1 to 2 of 2

Thread: HtmlInputCheckBox Control question....

  1. #1
    Join Date
    Dec 1969

    Default HtmlInputCheckBox Control question....

    I have 13 HtmlInputCheckBox Controls in my page <BR>Now once the user submits the page i want to get the value of the checked checkbox in the code behind page.<BR><BR>I am able to do this by the following code...<BR><BR>if (Page.IsPostBack)<BR>{<BR>if (chkFedEx1.Checked==true)<BR>{<BR> <BR> value = Convert.ToString(chkFedEx1.Value);<BR>}<BR>}<BR><B R>However, i don&#039;t want to write this if statement for all the 13 checkboxes. There has to be a better way to do this and I don&#039;t know how.<BR>I was thinking we can find the htmlcontrols, check if it&#039;s a checkbox and if it&#039;s a checkbox, check if it is checked and get the value.<BR>But, i don&#039;t know how to put this into code.<BR>Any help will be greatly appreciated .<BR>Thanks,<BR>

  2. #2
    Join Date
    Dec 1969

    Default Not sure if this works or not...

    I think I remeber doing it in a page a while back. If you name your checkboxes the same and then do a request.form("myCheckBox")<BR>it should give you a comma seprated list of the values. I could be way off though. Just a thought

Posting Permissions

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