Solved

Need example of dual list box, with database code

Posted on 2007-11-18
1
436 Views
Last Modified: 2008-02-01
Hello - Thanks, MacEx for your code snip for dual list boxes. Could you please elaborate on that, for use against a couple of database tables?

I'm trying to work up a page that allows a primary system user to specify the allowable divisions a regular staff-level user can access in a corporate financial system.

Given a lookup table like:

DivID / DivDesc
1  Accounting
2  Advertising
3  Engineering
4  HR
5  IT
etc...

...and a user control table like:
UserID / DivID
User01  1
User01  2
User02  2
User03  1
User03  4
User03  5
etc...

...I'd like to display the DivID's (that the user isn't already set up for) on the left-hand list box, and the DivID's they ARE set up for on the right-hand list box

I know what the queries (or views, or SP's) that pull the rowsource for the two list boxes needs to look like (I've done this before in MS Access/VBA). I just don't know how to code the list box events in VB.NET to pull the recordset's, and update them after an update.

And is that even the best way? Database updates after every listbox update, or pull the 2 rst's into arrays, do all the back & forth locally, until they click "Save", and then update the user control table? (this will be an intranet application)

Thanks; I hope this isn't over-reaching

Mark
0
Comment
Question by:mlagrange
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 20312353
With the ListBox control in ASP.NET there aren't a lot of events.  The basic one that you need is the SelectedIndexChanged.  In order for that to work properly, the page needs to post back.  This is usually accomplished by setting AutoPostBack = True for the ListBox.

Are the ListBox controls bound to a datasource, or populated with code?

Bob
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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
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.

758 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

20 Experts available now in Live!

Get 1:1 Help Now