consoleart
consoleart

Reputation: 151

Create Dynamic Controls using MVC3

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

Answers (1)

user670800
user670800

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

Related Questions