views:

154

answers:

1

In an asp.net MVC application, is it possible to reference views from a class library in the same way that it's possible to reference a class library of server controls or user controls in Web Forms asp.net?

I've seen this blog post: http://padcom13.blogspot.com/2009/04/splitting-aspnet-mvc-application-into.html, although the method described involves copying the views to be re-used into the application.

Any help appreciated, thanks.

+1  A: 

I guess it would be theoretically possible if you use a custom view engine which loads the templates from within the class library.

This approach, however, seems rather wrong. If you want to create an analogue of server controls, your best option is to implement them as Html helpers, as the MVC team already started. A shameless plug - you could look at the open-source Html helpers for jQuery UI that were built by Telerik - they use the outlined approach.

Alexander Gyoshev
Thanks Alexander.
Paul Suart