By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,556 Members | 1,259 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,556 IT Pros & Developers. It's quick & easy.

Associate a value with a check box C#

100+
P: 122
Ok here is the situation,

I have a panel that will dynamically load and add a list of check boxes from a database. I want to be able to identify what checkboxes were checked so that when i reload the data i can reload only the checkboxes that were checked.

I want to be able to associate the ID of the item loaded from the database that becomes the checkbox.

i.e

list of products and the client checks off the items they want to add to a cusom list.

the check box has no value and i am using the tag for something else, so where can i store the database id?

any help would be appreciated.
Feb 3 '09 #1
Share this Question
Share on Google+
1 Reply


vekipeki
Expert 100+
P: 229
Maybe you could create a light wrapper class and put it in .Tag instead of "something else"?

Something like (the basic idea):
Expand|Select|Wrap|Line Numbers
  1. class CheckBoxInfo
  2. {
  3.       string ID { get; }
  4.       SomethingElse { get; }
  5. }
And then create a new instance of CheckBoxInfo (or whatever you decide to name it) for each CheckBox. Would that break your existing code?
Feb 3 '09 #2

Post your reply

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