javascript - create tabs inside a tab view calling a controller action that returns a partial view -
i have created tabs using kendo tabs in below format. want create tabs inside div , show partial views each tab calling controller action , pass 2 parameters controller action returns partial view model data. have checked many solutions right solution solve requirement. can help.
<ul> @foreach(var item in model) { <li> @item.documentversion </li> } </ul> @foreach(var document in model) { <div> <p> @document.details </p> </br> <span> @document.file </span> </div> }
render partial in view (simplistic example)
<div> @{html.renderpartial("mypartialviewname", new { firstname = model.firstname, lastname = model.lastname}); } </div> <div> @{html.renderpartial("mypartialviewname","mycontroller", new { firstname = model.firstname, lastname = model.lastname}); } </div> create parameter view action
[childactiononly] public actionresult mypartialviewname(string firstname, string lastname) { // create model here... var model = repository.getthingbyparameter(firstname,lastname); var partialviewmodel = new partialviewmodel(model); return partialview(mypartialviewmodel); } example view code:
<p> @model.something </p> </br> <span> @model.otherthing </span> or markup in partial view:
<div> <p> @model.something </p> </br> <span>@model.otherthing</span> </div> current page:
@foreach(var document in model) { @{html.renderpartial("mypartialviewname", new { firstname = model.firstname, lastname = model.lastname}); } } note can pass model part document:
@foreach(var document in model) { @{html.renderpartial("mypartialviewname",document); } and partial view: (no parameters passed here...just model)
@model yourapp.model.document <div> <p> @model.details </p> </br> <span>@model.file</span> </div>
Comments
Post a Comment