Hi,
I am trying to render a different partial view based on a property of the model. I will then need to pass the model from the current enumeration to the Html.RenderPartial called in the template
as below i need to pass the current model from the edit to the RenderPartial i.e. "themodel". How do I get the syntax to pass the model to it?
Thanks
I am trying to render a different partial view based on a property of the model. I will then need to pass the model from the current enumeration to the Html.RenderPartial called in the template
as below i need to pass the current model from the edit to the RenderPartial i.e. "themodel". How do I get the syntax to pass the model to it?
Thanks
@using Assessments.Models;
@model IEnumerable<
FallsAssessment
>
@{
ViewBag.Title = "FallsAssessmentList";
}
<
h2
>FallsAssessmentList</
h2
>
@Html.Kendo().Grid(Model).Name("FallsAssessments").Columns(columns=>
{
columns.Bound(m => m.AssessmentType).Title("Assessment Type");
columns.Bound(m=> m.Ward).Title("Ward");
columns.Bound(m=>m.LastUpdated_TS).Title("Last Updated");
columns.Bound(m => m.LastUpdatedBy).Title("User");
columns.Bound(m => m.Score);
columns.Command(m => m.Edit().Text("Edit"));
}
).ToolBar(t=>t.Create()).DataSource(d=>d.Ajax()
.Model(
model=>
{
model.Id(id=>id.EventID);
model.Field(field=>field.EventID).Editable(false);
}).Create("Create", "FallsAssessment").Update("Update", "FallsAssessment")).Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("edit-template"))
FallsAssessmentFallsAssessmentFallsAssessment
<
script
id
=
"edit-template"
type
=
"text/x-kendo-template"
>
#if(AssessmentType=='Child'){#
@Html.RenderPartial("AdultAssessment",themodel)
#}else{#
@Html.RenderPartial("AdultAssessment", themodel)
#}
</
script
>