Update selected checkboxlist data to database

Posted on 2005-03-25
Medium Priority
Last Modified: 2012-05-05
Here is the situation:

I databind a checkboxlist with a user permission table in database to get a full list of available permissions, then I use datareader to get a specific user's permissions to populate the previous checkboxlist, then the admin can add and/or remove the user's permissions, then click "Update" button to update the user's permissions. My question is how I do the update part? How do I know which is added and which is removed?

Thank you very much,

Question by:prairiedog
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

LandyJ earned 750 total points
ID: 13631217
Are you looking for code or suggestions on method?

You can do it a couple of ways.  One, keep a dataset of existing permissions and compare it to the updated dataset, then change the values accordingly.  Two, on Update, set all permissions to "Off", then use the CheckedItems collection of the CheckBoxList control and set those Persissions "On"  

I'm sure there are other ways too, but these ar the two methods I usually use, with a strong leaning towards option 2.  It's more definite as to what is set On after processing is completed.
LVL 22

Author Comment

ID: 13727368
Sorry for my late replay. I actually figured out how to do it, but your reply really gave me a confirmation of what I wanted to do. So you got my 250 points.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question