473,509 Members | 3,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic usercontrol can't get values of the checkboxes

2 New Member
Hi all,

I have:
1. I have a place holder
2. I have a usercontrol which has just a datagrid in it.
3. I get data from the database and if get different categories.
4. I bind the datagrid with each category. I do not know how many categories will be.
5. The datagrid has a checkbox column (bound)
6. Once bound, I add the datagrid into the placeholder one by one.
--------------------------------------------------------------
Issue
1. Even though when i try to change the ID of the datagrid, it does not get changed, however, the controls within the datagrid do have the changed id. Hence, I get multiple <html> snippets with same ID.
2. Initially I was losing the placeholder upon postback. But then I came across an article that I need to rebuild the placeholder contents everytime in Page_Init. Which works fine now. THE ISSUE is that, upon reload, I lose all the checked items!!!

Please HELP!
Apr 3 '07 #1
1 1692
frankmusion
10 New Member
Hi all,

I have:
1. I have a place holder
2. I have a usercontrol which has just a datagrid in it.
3. I get data from the database and if get different categories.
4. I bind the datagrid with each category. I do not know how many categories will be.
5. The datagrid has a checkbox column (bound)
6. Once bound, I add the datagrid into the placeholder one by one.
--------------------------------------------------------------
Issue
1. Even though when i try to change the ID of the datagrid, it does not get changed, however, the controls within the datagrid do have the changed id. Hence, I get multiple <html> snippets with same ID.
2. Initially I was losing the placeholder upon postback. But then I came across an article that I need to rebuild the placeholder contents everytime in Page_Init. Which works fine now. THE ISSUE is that, upon reload, I lose all the checked items!!!

Please HELP!
Well if you rebuild the placeholder then you need to rebuild everything that's in it also. The way that works is the view state has all the info needed to keep the same state of the page after post back. If you rebuild the controls then how is it going to know where to put the checked values. I would either find another way of doing what your doing or loop through the Request.Forms.AllKeys collection and set the checkboxes one by one. Why don't you post what you trying to do so we can maybe suggest a different way of doing it. Hope this helps.
Apr 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3718
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access...
1
1611
by: middletree | last post by:
Hate to post this in a separate post, but felt that the last thread was too far down to get noticed. It is called dynamic checkboxes, and it contained some good advice for me, but it led to...
1
1265
by: tascien | last post by:
I have a user control that has dynamic controls loaded to it in Page_Init. this works well. I have a function inside the user control: GetValues() When i add this usercontrol to a page:...
0
1822
by: Axel Dahmen | last post by:
Hi, I've created a UserControl containing an <asp:Repeater> control, containing an <asp:Checkbox> control: /------------------------- <asp:Repeater Runat="server" ID="propRpt"> ...
2
3333
by: John Ninan | last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application I have a combobox(aspx Page). Which contains various items. Based on item selected I am dynamically populating...
0
1102
by: vbMental | last post by:
I created a user control that, had a datalist with checkboxes inside of the item template. These checkboxes would not retain state. For instance, if I set them to checked inside of the load event...
3
5714
by: Jack Black | last post by:
Using VS.Net 2k3 to build ASP.Net app with VB code-behind pages... Hi, all! I've been struggling with getting a dynamically-generated CheckBoxList generated. I've finally been able to get the...
1
4094
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
0
1016
by: thinkoid | last post by:
Hi all, I have: 1. I have a place holder: phAT 2. I have a usercontrol which has just a datagrid in it. 3. I get data from the database and if get different categories. 4. I bind the datagrid...
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7412
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...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3216
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...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
441
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...

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.