Reputation: 151
I need to create dynamic fields (textbox,combo) based on the entries in an XML file
I will read the ATTRIBUTES XML tag and must create the type of control and add validations to it. Can someone say how to use MVC3 to create dynamic controls, becos i cannot have different class for models as the XML file will change for each screen and i will have one screen which will generate this page for me...
Upvotes: 0
Views: 1751
Reputation: 1115
perhaps you can create your own html helper functions to do that. There are built-in helpers such as html.TextBoxFor(x => x.id)
. So you might write your own html.RenderFor( () => xmlDocumentBindedToyYourView )
And your controller for example
public ActionResult render()
{
XMLDocument xdoc ; // do your xml doc reading....
return View(xdoc);
}
Upvotes: 2