CSLA .NET

From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books

Asp.Net - Selecting categories

rated by 0 users
This post has 3 Replies | 0 Followers

Top 10 Contributor
Posts 3,715
Andy Posted: Tue, Jun 30 2009 9:00 AM
Hi,

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?

Thanks
Andy
Top 10 Contributor
Posts 3,715
Andy replied on Mon, Jul 13 2009 8:20 AM
Is there something simple that I'm missing?
Top 10 Contributor
Posts 1,244

Andy,

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!

Joe

 

Top 10 Contributor
Posts 3,715
Andy replied on Tue, Jul 14 2009 8:16 AM
Joe,

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.

Andy
Page 1 of 1 (4 items) | RSS

Please contact Magenic for your .NET consulting
and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems