CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Location
    Mobile, AL.
    Posts
    64

    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.

  2. #2
    Join Date
    Jul 2007
    Location
    Sweden
    Posts
    331

    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
  •  





Click Here to Expand Forum to Full Width

Featured