Solved

Linq: Set Checkboxlist based on values set in sql table

Posted on 2011-02-21
3
610 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now