Tuesday, February 26, 2008

i think this is a bug

I am writing a little app that hosts the Internet Explorer/Webcontrol control to navigate our production site and get some page load values. Somewhere on a page we have the following html snippet:

<input name="foo" type="checkbox" id="foo" />

Both IE and Firefox render this as a checkbox without the check mark.

When I interrogate the attributes inside the HtmlElement object, here is the interesting bit:

GetAttribute("Value") returns "on"
GetAttribute("checked") returns "False"

I wrote a loop to get all the input elements inside the <Form> tag to construct a post data string so the natural choice is to use the Value attribute because it seems to work for all input types. So the post is sending in foo=on for this input. ASP.Net happily interprets it as checkbox value=true and created a different behaviour that took me a while to track down and isolate.

No comments:

Listed on BlogShares