-
July 16th, 2007, 02:46 PM
#1
HtmlInputCheckBox Control
I have a web page which populates various controls (HtmlInputTextBox, HtmlInputSelect, HtmlInputCheckBox, etc.) into htmlcells of an htmltable. The user can modify these controls and then click a "Save" link. This Save routine goes and finds all the controls, gets the value/setting of the control, and then saves the results to a database.
I use the command "Page.Request.Form[controlName]", where "controlName" is the name of the control, to retrieve the value. However, sometimes the HtmlCheckBoxControl is returned as "null" as if it isn't found. I noticed this happens after the checkbox is unchecked by the user.
-
July 17th, 2007, 07:43 AM
#2
Re: HtmlInputCheckBox Control
Request.Form is an array of values sent back by the browser through a POST request (just as Request.QueryString holds values sent through the path after the question mark).
An unchecked checkbox should not have its value submitted to the server, so you're seeing the correct behavior. Basically what you need to do is to assume that the checkbox is not checked when it is not included with a submitted form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|