Solved

Need example of dual list box, with database code

Posted on 2007-11-18
1
439 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

22 Experts available now in Live!

Get 1:1 Help Now