-2

In web forms I could load a user control via a string replace when parsing data from the database.

Is it possible to do this in MVC? What I am trying to achieve is to allow users in a cms to register a form in a page via a text string [form contact] and then for the controller to replace that with the correct form.

If not, then would jquery work?

Thanks.

DCADS
  • 73
  • 2
  • 8
  • -1: Please at least make title reflect your question. Loading view from controller (partial or not) is easy as Arijit Mukherjee's answer shows, but it does not look like what you are looking for. – Alexei Levenkov Jun 09 '14 at 06:00
  • I've edited the question to specify string replacement. Apologies if the question was not as accurate as it should have been. – DCADS Jun 09 '14 at 06:52

1 Answers1

1

Try

public ActionResult ActionName(ModelName modelObject)
{
//Desired Code
return PartialView("name of the partial view", someViewModel);
}
Arijit Mukherjee
  • 3,817
  • 2
  • 31
  • 51
  • While technically correct, it does not answer the OPs use case. They asked the wrong question in the title. – Sam Axe Jun 09 '14 at 05:44