Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need example of dual list box, with database code

Posted on 2007-11-18
1
Medium Priority
?
471 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 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