views:

10

answers:

0

I have a fairly large ASP.NET MVC 2 application that requires a large amount of user profile based data customization. This involves things like adding/removing table columns or applying user specific column headers in data returned by AJAX requests. There are dozens of types of customizations possible and there are many permutations supported.

Loading and storing the user preferences is not an issue.

Currently, these customizations are applied from a combination of filters applied to controllers and a chain of very verbose static functions in a large utility class -all called directly from the controller. This has a code smell something between good cheese and bad diapers.

We would like to refactor this, but it seems unclear where the best place in MVC to perform these types of customizations should be. This seems like something you would want to do with a viewmodel, but with an AJAX request returning a JsonResult.

Is there a commonly implemented way of creating viewmodels based on user customizations like this?

What is the best practice for implementing this level of data-view customizability in ASP.NET MVC applications?