Solved

2 Interactive Multiple Select Listbox in ASP.NET C#

Posted on 2007-11-23
6
3,579 Views
Last Modified: 2013-11-26
Hi,

I have the following table that I want to work with 2 multiple select listboxes.
Between two listboxes (inactive & active) are two buttons with opposite direction arrows
indicating where to place a selected item. The "active" column will be updated
each time an item is moved. For example if moved from inactive to active, "active" column will be updated to True. Also, I want to add an option to add a new area -- that would automatically added to the inactive listbox.

areaID      int      Unchecked
areaName      varchar(150)      Checked
weight      int      Checked
active      bit      Checked
createDate      datetime      Checked
updateDate      datetime      Checked  

To picture it out better, here's an illustration:
http://i62.photobucket.com/albums/h116/ikaruga7/multiselect.jpg

Can anyone provide me an example of how to do this in ASP.NET C#? Or perhaps just point me into the right direction. Is ajax needed to accomplish this? Or can this be done in purely C#?

Thanks in advance!
0
Comment
Question by:JaimeJegonia
[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
6 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20339698
Ajax will be required, or else the other work around is using javascript to do this, but if you are using javascript to accomplish this then EnableEventValidation will have to be "false" at the top of the page in <@ Page %> tag.
The same thing i also had done in one of my web projects where i used my won Javascript stuff, as i didnt wanted a server trip to me made. Ajax does a server trip for adding or removing the data from data list.

I google you will find many javascript code example which you can then customize for yourself. Hope this helps you finalizing what you want to do. The major thing is Server Trip here.
0
 
LVL 20

Expert Comment

by:informaniac
ID: 20341840
There's a whole lot of things that you'll have to do.
Using Ajax would be better rather than writing Client Callback.

Since you are going to hit the server to make changes in the database table it is better to use ajax, to keep it simple as far as coding is concerned.

To start of with:
Place the listboxes in updatepanels.

Then write events on click of Add button and remove buttons.
Wherein u'll have to hit the database and update the column active.

To check which items are selected in listbox use this code

foreach(ListItem Li in listbox1.Items)
{
      if(Li.Selected)
          --do something
}
0
 

Author Comment

by:JaimeJegonia
ID: 20362735
Can anyone provide a code to show me how to accomplish this?
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 23

Accepted Solution

by:
Ashish Patel earned 500 total points
ID: 20363250
0
 

Author Closing Comment

by:JaimeJegonia
ID: 31410664
Thanks asvforce. The article is a good help. The sample code doesn't have the exact functionality I want but it's enough to get me started and arrive to expected result.
0
 
LVL 5

Expert Comment

by:Khalid Mehmood Awan
ID: 32260213
Link removed.... Asvforce, please update this knowledge base question....
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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