tbaseflug
asked on
Datalist - Listbox: Parse CSV string/value and pre-select multiple items
I have a listbox and am allowing the user to make multiple selections from it - the selected values are combined and concatenated via the below code and then insterted into a single SQL column.
Dim str3() As String
Dim strHardware As String
For i As Integer = 0 To lbServersHardwareAffected. Items.Coun t - 1
If lbServersHardwareAffected. Items(i).S elected = True Then
strHardware = strHardware + lbServersHardwareAffected. Items(i).T ext
strHardware = strHardware + ", "
End If
Next
If Not strHardware = "" Then
strHardware = Left(strHardware, Len(strHardware) - 2)
End If
str3 = strHardware.Split(CType(", ", Char))
What I am trying to do is to grab the results from the SQl column (e.g. = value1, value2, value3) and setup a listbox in a datalist to pre-select the values. I am using a Dataset and a store rpocedure to select and return the data from the database. Need it in VB.NET if possible -
Dim str3() As String
Dim strHardware As String
For i As Integer = 0 To lbServersHardwareAffected.
If lbServersHardwareAffected.
strHardware = strHardware + lbServersHardwareAffected.
strHardware = strHardware + ", "
End If
Next
If Not strHardware = "" Then
strHardware = Left(strHardware, Len(strHardware) - 2)
End If
str3 = strHardware.Split(CType(",
What I am trying to do is to grab the results from the SQl column (e.g. = value1, value2, value3) and setup a listbox in a datalist to pre-select the values. I am using a Dataset and a store rpocedure to select and return the data from the database. Need it in VB.NET if possible -
what are you doing after you split them, how are they stored in your db field?
ASKER
They are actually combined and then stored in the db field as:
value1, value2, value3
What I need to do is split them from the db
value1, value2, value3
What I need to do is split them from the db
I use this to split csv from my sql server for a csv of users:
HttpContext.Current.User = New GenericPrincipal(User.Iden tity, Split(authTicket.UserData, ","))
HttpContext.Current.User = New GenericPrincipal(User.Iden
ASKER
Any idea how I would set the selections to a listbox to from something like that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Let me give it a shot and will let you know as soon as I am done - thanks!!!!