473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkboxes and NamedValueColle ction

Can someone please explain the rationale behind not putting a checkbox
reference into the postback data collection?

I have a composite control (supporting IPostBackDataHa ndler) which
populates a DataGrid with dynamic controls (textboxes, labels,
dropdownlists, etc). Until I started to implement support for
checkboxes all of the previous controls are always
represented/available in the postback data collection. - not
checkboxes.

Apparently checkboxes only show up in the collection if they're
checked. Aside from being a frustrating none-to-well documented
"feature" this requires the composite control code to handle
checkboxes differently.

Anyone wishing to shed some insight into this odd feature is welcome.
Nov 18 '05 #1
2 1582
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.)

Nov 18 '05 #2
Hi glenn.owens,

I would like to follow up on this issue and see if any progress has been
made. Were you able to check my reply? Should you have any questions,
please feel free to post here.
Looking forward to your reply!
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3966
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
8
2833
by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the boxes and saving to the database at the end with the 'Submit' command button. Is it possible to save the changes as the checkboxes are clicked? I suppose I'd need to write some dynamic ASP event handling at the same time as creating the checkboxes......
8
2842
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here is my code line that creates each checkbox (the php variable get
5
5895
by: @(none) | last post by:
I have a page which is a set of CheckBoxes generated daily and thus the number of Checkboxes changes each day. What I want to do is allow the user to select one or more checkboxes and the push a "Done" button and then have a script which uses a "for" loop to check the status of each box. The code I use for this is Sample checkbox HTML <P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox0"
6
2850
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++) checkboxes.checked=thestate } This works fine - but the problem is that it doesn't work with my
10
5211
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
5
11281
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: for (int i = 0; i < 160; i++) { string checkbox = "checkBox" + i.toString(); (Cast)checkbox.enabled = false;
8
6042
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the ideal case I would like to see all of the source code for a complete working example of a ListBox of CheckBoxes.
7
2295
by: viki1967 | last post by:
I need one function javascript that: 1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled; 2-a) If I select the checkbox of macrocategory A, M and T checkboxes all disabled; 2-b) If I select the checkbox of macrocategory M, A and T checkboxes all disabled; 2-c) If I select the checkbox of macrocategory T, A and M checkboxes all disabled; 3) If I select the...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.