Click here to Skip to main content
15,949,746 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I am going to attempt to explain what I am trying to do real quick and then go on to the man subject. I have 403 potential checkboxes that a user can select to request access for a potential software function. So to solve this I created multiple treeviews that have all the possibilities. Example of one of many shown below:

ASP.NET
<asp:TreeNode Text="ABC" Value="ABC">
                    <asp:TreeNode ShowCheckBox="True" Text="ARL" Value="ARL" />
                    <asp:TreeNode ShowCheckBox="True" Text="ARL_R" Value="ARL_R" />
                    <asp:TreeNode ShowCheckBox="True" Text="ARL_F" Value="ARL_F" />
                    <asp:TreeNode ShowCheckBox="True" Text="CLE" Value="CLE" />
                    <asp:TreeNode ShowCheckBox="True" Text="FWE" Value="FWE" />
                    <asp:TreeNode ShowCheckBox="True" Text="FWE_R" Value="FWE_R" />
                    <asp:TreeNode ShowCheckBox="True" Text="FWE_F" Value="FWE_F" />
</asp:TreeNode>


The user then selects each node he choices from the series of treeviews. The problem I'm having is technically more of a storage issue. I will then check all the nodes the user has selected and push them towards a table in an sql database. The database stores simple fields such as: last name, first name, id number, supervisor email, etc. One of the fields I am trying to utilize is the "access" field which stores all the checkboxes that the user selected but if he selects 403 options you can imagine that would look horrible with values such as arl, arl_r, and etc collapsed into another string. Is there an easier way to store values from a treeview and know where they came from? For example if he selects ARL, could I not do some type of binary math saying that if he toggled arl that is the first bit of an 8-bit number? I may be even far off the path by using Treeviews to begin with.
Posted
Comments
Sergey Alexandrovich Kryukov 6-Jun-11 12:50pm    
Why it is a problem? Do you use data binding? If you do, how your check boxes are different?
--SA
Silivestige 6-Jun-11 13:01pm    
It's not about the checkboxes that makes it different. It is more the fact that I need to store up to 403 values and am unsure the proper way to do it. Originally I used a string to store each checkbox by the node.value if checked. What I soon found out is the string would have up to 1400 characters stored based on their selections. From a storage standpoint to see a string of 1400 characters in 3-5 increments that is just horrid. Functionally it would work but it would not be the most ideal solution. Guess the true question is "how to store larges amounts of values and have them indexed in a manner that is simplistic."

1 solution

The first I would say is to redesign your architecture and display. 403 options is far too many to be reasonably usable. If I see an application with that many checkboxes I'll delete, quickly, and go for something less complex that does the same thing.

Yes you can use an integer to store the bit flags that represent the selected values. However, once again, you will have too many values to make it usable.
 
Share this answer
 
Comments
Silivestige 6-Jun-11 13:13pm    
Let us expand on this architecture then. What the user has is a series of what we call a node on a system. Each node allows a user to see a specific data set of information based on the 9 major classes that relate to a certain service area of work. Each service area of work has the possibility of containing additional service areas of work or flat out access points for the users. For example, WDC has one service area of work ABC, which has 7 access points. WDC contains 23 total service areas of work, with multiple access points in each service areas of work. The user then selects all access points from various service areas of work in which he needs. Guess the challenge is in granting the same amount of access without allowing the user to need to select 403 items.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900