Reputation: 883
I am new to MVC3. I am using razor.
I have a menu with 4 items. With each click, a different partial view should open.
Could anyone help me out here..
Preferably, without using a controller on server side..
Thanks, Aneesh
Upvotes: 0
Views: 3591
Reputation: 5465
You have to create an object where all the data that you want show on the all the different partial views. Then use @Html.RenderPartial to render your desired partial. Use the second parmater to add the data.
Example: @{Html.RenderPartial("_Customers", Model.CustomerList);}
Upvotes: 0
Reputation: 3267
Html.RenderPartial is what you need if you don't what to use a controller:
If you want to render partial view using controller action then use Html.RenderAction: http://msdn.microsoft.com/en-us/library/system.web.mvc.html.childactionextensions.renderaction.aspx
http://devlicio.us/blogs/derik_whittaker/archive/2008/11/24/renderpartial-vs-renderaction.aspx
Upvotes: 4