ASP.NET MVC based CMS - dynamic generation of form helpers
Posted
by user252160
on Stack Overflow
See other posts from Stack Overflow
or by user252160
Published on 2010-03-12T16:30:30Z
Indexed on
2010/03/12
19:47 UTC
Read the original article
Hit count: 304
I am working on an ASP.NET MVC based CMS that presents a rather extreme case. The system must allow the user to add custom content types based on different fields, and for every field, one can add options and validations. The thing is that everything is stored in a complex DB and extracted at runtime using LINQ.
I am pretty fresh with ASP>NET MVC so the following dilemma came to mind How should I make the content creation view so that form helpers are not predefined int he view code but are loaded based on the type of the field ? Do I have to create a factory class that checks the value of the type property of the field, and then returns a helper based on that or there's a better way to do it. This one seems pretty rigid to me , because anytime I make a change in the Fieldtypes table, I will have to make sure to create a check for that new type too.
© Stack Overflow or respective owner