0

I have been developing an asp.net mvc3 application.

Here is my situation: The controls that are supposed to be displayed in the view page is in database. In database we have stored all the control definitions, for example control type, validation regex, required or not. Currently what i am doing is, i am retrieving the records for controls and using html helpers to build the form elements and displaying the view page.

The problem with this approach is that, i can't use jQuery unobtrusive validation.

Is it possible to have a dynamic model to which i can add properties and data annotation at runtime and display the view page. doing this way i will have a page which can support jQuery unobtrusive validation.

or

please suggest any other alternative solution.

1

1 Answer 1

1

Maybe you can check this: https://stackoverflow.com/a/3609521/1241400 or call $.validate.unobtrusive.parse("#selector") after you load the form. and for dynamically building a model check this great post: http://romiller.com/2012/03/26/dynamically-building-a-model-with-code-first/

Regards

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.