473,668 Members | 2,357 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 1696
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.A llKeys 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
3734
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 database? Basically, I have a form on which I have a series of statements, with 3 checkboxes for each statement - YES, NO, MAYBE. This series of statements is being dynamically populated from a query of a table in Access, called "tblQuestions". In...
1
1621
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 another question, and I wanted to go ahead and post my question here in hopes of getting an answer. The advice given to me about having a number of checkboxes which are put onto the page from the database, was to name them all the same thing, and...
1
1278
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: test.aspx and i call GetValues(), it returns me the values of the dynamically added controls correctly.
0
1828
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"> <ItemTemplate> <tr><td> <asp:CheckBox Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Description")%>' TextAlign="Right"/> <asp:Literal Runat="server" Visible="False" Text='<%#DataBinder.Eval(Container.DataItem,"ID")%>'/>
2
3341
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 Usercontrols. Problem: When I am populating dynamic user control (ascx) page in Page_load event it works fine for the first list item from combobox. When I change the item in combobox, usercontrols are build properly but value will be same in second...
0
1112
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 of the UserControl, they would appear false(the default value) when inside the top level datagrid. Here's the walkthrough (tried to make it as quick as possible): Start a new ASP.NET Web Application project. 1. Create a usercontrol....
3
5747
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 list generated, but now there are two problems I haven't been able to overcome: 1) ASP.Net is munging the checkbox ID/Names of the checkboxes: I give it a name like "myCheckbox" and asp.net is creating the checkboxes with the name...
1
4104
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: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
0
1020
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 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. --------------------------------------------------------------
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8575
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
7398
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
4202
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...
1
2784
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
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
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.