jquery - Best method to create dynamic Html Controls In MVC -


i have requirement create dynamic html controls , display in view using mvc in .net , need basic validation i.e - if textbox should not empty , if checkbox , validate checkbox checked or not. same time after successfull validation need save in db.

would please tell me approach best achieve this? should not affect preformance.i have list of options in mind 1. using htmlhelperclass,string builder,tag builder. 2. jquery

i dont know option easy , best achieved.

htmlhelper classes of great help. if need implement basic validations required field or regex can rely on validation attributes mvc provides , use model e.g

[required] public string firstname {get; set;} 

you can write own custom attributes , use on model classes

this of great help

a rough sketch dynamic ui

write model class bound db (this contain details of ui controls type,name,attributes etc.). when default controller action hit first time, initialize model , pass on corresponding view, bound model. pretty simple then, can read model values in view , accordingly place ui elements using htmlhelper methods


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -