Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET Checkbox List - How to read what was checked after submit

Posted on 2007-11-16
3
Medium Priority
?
1,004 Views
Last Modified: 2010-04-21
Hi Experts,

I have a dynamic checkbox list

<asp:CheckBoxList ID="CheckBoxList1" DataSource="<%# DataSet1.DefaultView %>" DataTextField="Description" DataValueField="ID" runat="server" RepeatDirection="Vertical" RepeatLayout="table"></asp:CheckBoxList>

Works great and displays correctly.

Once the user has checked the boxes they want, how do I read what was checked on the submitted page?

What I am trying to do is build a page that checks for available times in the database

Eg: The user may select Lesson1,Lesson2 and Lesson6
The resulting page will search the database for anything with those requirements and return a datagrid or repeater.

How do I know what boxes have been ticked so I can build my query.
Thanks a lot
Nik

0
Comment
Question by:nikdonovanau
[X]
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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
digitalZo earned 2000 total points
ID: 20303608
VB Code [for multiple user selection]

http://authors.aspalliance.com/aspxtreme/webforms/controls/determiningselectioninlistcontrol.aspx

the selections are stored in the variable s. You can retrieve the data giving the WHERE clause using this variable and it will accordingly retrieve the data.


 Dim s As String = "Selected items:"
        For Each item As ListItem In CheckBoxList1.Items
            If item.Selected Then
                ' list the selected item
                s += item.Text + "<br>"
            End If
        Next
 
[SQL Query]

Open in new window

0
 
LVL 10

Expert Comment

by:digitalZo
ID: 20303625
0
 
LVL 1

Author Closing Comment

by:nikdonovanau
ID: 31409713
Thanks very much for that. Thats what I was after.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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