Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a number of HTML files - each implements one jQuery UI dialog. Some of them are static, but others are dynamic, i.e. require use of Model.

What is the right/easiest way in MVC4 to execute Razor dynamically, passing it a model as parameter?

There seems to be lack of information about it in the web, just some, using older versions of MVC, and I'm hoping MVC4 got some improvements in this area.
Posted
Updated 17-Jun-13 0:51am
v6
Comments
Jameel VM 17-Jun-13 10:33am    
did you try partial View?
Vitaly Tomilov 17-Jun-13 10:40am    
I did. Partial view give you pretty much a static page, i.e. generated only once, which means I would have to place all of my dialogs into a container and generate them all at start. I have lots of dialogs. Not only I do not want to generate every feasible dialog inside container, I want to do this only when needed, which means engaging razor engine dynamically, hence the question.

1 solution

You no need to place all of your dialogs in one container.Before returning the partial view set the dynamic data of your dailog in viewData or Model. The Model or ViewData will be common for all dialogs.Try this for creating dynamic partial view
http://gunbladeiv.blogspot.in/2011/06/part-3-create-dynamic-partial-view-on.html[^]

Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900