Reputation: 341
I'm designing an ASP.NET screen which configures what screens are relevant for a particular type of record. For example a car record will have access to the Ford and Ferrari pages. I'm displaying a listbox on the left with all available items, and a listbox on the right with currently selected items. Two arrow icons allow you to move items from left listbox to right listbox and vice versa.
I'm trying to figure out a good way of storing the selected access. Easiest would be to delete all the currently selected items and reinsert the items from the Selected Items listbox. But the changes need to be audited more accurately so need individual inserts and deletes. Should I store the original items in a hidden field and then try to compare the final selected items with the original? Should the work be done in the Presentation layer, within an object or in a stored procedure?
Thanks for any guidance, Dean
Upvotes: 0
Views: 906
Reputation: 48088
If you want the selection to be persistant you should store them in DataLayer.
Business Layer : Car Entity and Cars Collection
At server side you can create a collection of items that contains all (selected/ not selected) items.
A car entity item requires its name, id and selected info. store this collection in session when user enter the page and check it whenever you want.
Here is a Car Item :
CarItem
- Id
- Name
- IsSelected
Upvotes: 0
Reputation: 39261
I would not do it on the presentation layer, send the new list to your business layer. In there retrieve the current list and do a compare with the new list. The do your inserts and deletes based on that.
Upvotes: 1