Asp.Net - Selecting categories
Asp.Net - Selecting categoriesOld forum URL: forums.lhotka.net/forums/t/7196.aspx
ajj3085 posted on Tuesday, June 30, 2009Hi,
I have an Asp.Net web app, using Csla objects. One of the use cases allows a user to assign categories by highlighting the choices on a multiple select.
What's the best way to handle this? The root BO contains all the possible categories, with a Selected value? Should the categories just be added / removed, much like a winforms application?
ajj3085 replied on Monday, July 13, 2009Is there something simple that I'm missing?
JoeFallon1 replied on Monday, July 13, 2009
I have done this two different ways with one or two multi-select list boxes. It depends on what you are trying to show the user.
For 1 listbox, the datasource is the BO property. You then create a 2nd BO property which is a List(Of String) which holds the selected values. In the UI you need to write a bit of code to process the selected values, add them to a List(Of String) and then store that list in the BO. You also need to add a bit of code to populate the list box when the user returns to the page and then run over the list of selected values and re-select them for the user.
For 2 listboxes where you move one from the Available list to the Selected list - it can be done but is a real pain in the ***. See if 1 listbox works for you!
ajj3085 replied on Tuesday, July 14, 2009Joe,
Ya, thats the only way I could come up with too. I was hoping for an easier way. :-)
I only need the one listbox, and fortunatly this is an insert only type of page (the user submits the information, and it goes off somewhere else.. no way for them to see it again!)
Thanks for the response.. I'll start working on that implemenation now.
Copyright (c) Marimer LLC