Last post Feb 23, 2012 07:53 AM by Qin Dian Tang - MSFT
Feb 21, 2012 08:48 PM|slimbunny|LINK
I have a dataGrid with a dataList within. The dataList has a checkbox and I need to grab all the checked items from the Datalist.
My code is giving me all the checkboxes including the unchecked boxes multiple times.
How do I only get the checked items Please note I am not sending data to database yet, I am checking the data first. Can someone please share your expertise in making this happen. Your help is greatly appriecated.
thank you much..... Is it possible that my for loops are not in the correct order.
'Setup for selected items
Dim myList As New List(Of Integer)
'Iterates through the rows of the DataList control
For Each x As DataListItem In dlClientBusiness.Items
For i As Integer = 0 To dlClientBusiness.Items.Count - 1
Dim DLCkBox As CheckBox = DirectCast(dlClientBusiness.Items(i).FindControl("ckBox"), CheckBox)
Dim lblDDParentID As Label = DirectCast(dlClientBusiness.Items(i).FindControl("lblDDParentID"), Label)
Dim lblDLUniqueID As Label = DirectCast(dlClientBusiness.Items(i).FindControl("lblDLUniqueID"), Label)
If DLCkBox.Checked = True And DLCkBox.Visible = True Then
'setting up MyList
'Save to database
Dim eFlag As Boolean = False
For x As Integer = 0 To myList.Count - 1
'send to Class
xUserAccess.addUserAccess(xUserName, tlrDataPicker.SelectedDate, myList(x))
'testing show data input
- Here I am checking for checked items
- I get the checked items but duplications. I need to only get the checked items without duplications.
lblSelectedItems.Text &= myList(x) & tlrDataPicker.SelectedDate & "<br />"
lblSelectedItems.Text &= "______________________________<br /><br />"
'check for errors
If xUserAccess.errorFlag Then
eFlag = True
Feb 23, 2012 07:53 AM|Qin Dian Tang - MSFT|LINK
Please refer your another post: