Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 667
  • Last Modified:

Linq: Set Checkboxlist based on values set in sql table

I have a checkboxlist capture various pieces of data.  I capture selected checkboxes and store in a corresponding table with a '0' variable for False - not selected or '1' True - selected.  I want to reset my checkboxlist based on the record value in table.  How can I do this and is Linq possible?  If not I'm willing to right the code I just need some best practice suggestions.

See below what I have so far.

Screencast displays the checkboxlist groupings.
rtreadwell-411961.flv
0
Robert Treadwell
Asked:
Robert Treadwell
1 Solution
 
carlnorrbomCommented:
Hi,

Not sure I fully understand your question? What do you mean by "I want to reset my checkboxlist based on the record value in table"? You basically want to establish a two-way data binding or what? Please clarify.

/Carl.
0
 
Robert TreadwellAuthor Commented:
Yes If there is a way to two-way bind a checkboxlist that's what I want to do.  currently I'm looping through the control to determine if the listitem is selected.  if it is then I set a corresponding column to '1'. When user record is revisited,  I want to be able to retrieve that record and then look at each column and set the checkboxlist with all the selected values set previously.  Followed by, if there are any updates then setting the new updates back to database.  

Currently to set record I am using a For/next loop to check for the selected item.  i guess I could do the same thing in reverse.  but it seems to me that there has to be a easier way.  
0
 
CodeCruiserCommented:
I think it has to be done in a loop.
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now