DataList + CheckBox

  • Thread starter Paperback Writer
  • Start date
P

Paperback Writer

I have a DataList with a lot of items where the user can select them trough
the CheckBoxes but i don't have idea how to capture these values from the
checkboxes to insert in my DataBase....How to accomplish that ?
 
G

Guest

You have to iterate through each item in the datalist find the checkbox
control and check if it is selected. assuming your datalist's id is dl and
the checkbox id is controlsid

Dim alSelectedValues As New ArrayList

For Each item As DataListItem In dl.Items
'check the item isn't a header or footer
If item.itemindex > -1 Then
Dim cb As CheckBox = item.FindControl("controlsid")

Dim value As String = cb.Text
Dim checked As Boolean = cb.Checked

If checked Then
alSelectedValues.Add(value)
End If
End If

Next

good luck jd
 
G

Guest

This code is OK only for Datagrid not only for Datalist. I search the way to
access the footer data from outside of dataset event. If u have, pls inform
me.
Kaung Htut Oo
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top