Solved

2 Interactive Multiple Select Listbox in ASP.NET C#

Posted on 2007-11-23
6
3,578 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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