Solved

Linq: Set Checkboxlist based on values set in sql table

Posted on 2011-02-21
3
622 Views
Last Modified: 2012-05-11
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
Comment
Question by:Robert Treadwell
3 Comments
 
LVL 18

Expert Comment

by:carlnorrbom
ID: 34949334
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
 

Author Comment

by:Robert Treadwell
ID: 34951711
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
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 35021817
I think it has to be done in a loop.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…

831 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