c# - Creating model/view/controller tha simulate a parametrized query in ASP.NET MVC? -
well, creating app allows me query database using asp.net mvc 5 entity framework 6.1.3.
well came across situation. have database several connection strings let me access different databases.
so want create model user can create queries upon databases. came idea let user create he/she creating question. instance: want know how many students studying in faculty {placeholder}? "how many students studying in faculty label , {placeholder} combobox. combobox filled list of faculties (a query table of database).
my idea provide user links in order add many labels, textboxes, comboboxes, etc. him create question. if user create question above add label, , combobox. he/she fill information, , other function (i develop not main goal of question) satisfy query.
so, how can runtime create link add me (label, textbox, etc.) items in runtime view, , gather information , save database (for model in question)?
i´m guessing link view(or viewmodel?) has pass information controller , , render view , let view know there new "control" (how named model controls) , render (or else). how can achieve that?
hope explained myself. if not, please comment , i´ll try better.
thanks in advance!
you're trying create dynamic fields, right?
you can add inputs , selects javascript,then, in controllers, can parse many objects parameters need.
for example, can create new model called "question", defined structure like:
public class question { public string label {get; set;} public string placeholder {get; set;} }
and in controller:
public actionresult somecontroller(question[] questions) { ....
the difficult part creating submit data.
i found these links in can that.
passing list of objects mvc controller method using jquery ajax
Comments
Post a Comment