Hi glenn.owens,
Thank you for using Microsoft Newsgroup Service. Based on your description,
you've made a custom web control which has some entry fields in it, when
posted back to server you retrieve the datas in the entry fields via
"LoadPostDa ta" event? However, you found all entry fields' value can be
retrieved correctly except the checkbox control whose value is avaliable
only when it is checked. Is my understanding of your problem correct?
As for this problem of checkbox, I think it is a natural feature of the
html check box(not particularly for the ASP.NET checkbox control). For
example, in a common html page if you use a html checkbox such as:
<input type="checkbox" value="CheckVal ue" name ="chkTest" />
When the page is posted to serverside, you can retrieve the checkbox's
value(from request.form or querystring) only if
it is checked. Otherwise, there won't be object in the posted data's
collection which repreresent the checkbox's value. As for your situation,
you retrieve the value in the Custom web Control's "LoadPostDa ta" event,
from the postCollection[postDataKey] collection. In fact the data in the
"postCollection " is just from the Request.Form collection which contains
the client entry fields' value. So if the checkbox is not checked, there
won't be any object which represent its value. Thus, if we need to deal
with checkbox in the event, we need to code different from other controls.
Please check out my suggestion. If you have any questions on it, please
feel free to let me know.
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)