Solved

Datalist - Listbox: Parse CSV string/value and pre-select multiple items

Posted on 2004-09-09
7
433 Views
Last Modified: 2008-03-17
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.Count - 1
            If lbServersHardwareAffected.Items(i).Selected = True Then
                strHardware = strHardware + lbServersHardwareAffected.Items(i).Text
                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 -
0
Comment
Question by:tbaseflug
  • 4
  • 3
7 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12021234
what are you doing after you split them, how are they stored in your db field?
0
 

Author Comment

by:tbaseflug
ID: 12021283
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
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12021329
I use this to split csv from my sql server for a csv of users:

HttpContext.Current.User = New GenericPrincipal(User.Identity, Split(authTicket.UserData, ","))
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 17

Expert Comment

by:AerosSaga
ID: 12021345
0
 

Author Comment

by:tbaseflug
ID: 12021357
Any idea how I would set the selections to a listbox to from something like that?
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 12021368
Once you have them to strings insert them like this:

ddl.Items.Insert(0, MyStringVariable);
0
 

Author Comment

by:tbaseflug
ID: 12027063
Let me give it a shot and will let you know as soon as I am done - thanks!!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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 …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

13 Experts available now in Live!

Get 1:1 Help Now