简体   繁体   中英

Render PartialView into section

I've got a section Left that contains navigation content for my specific page.

Now I want to display a TreeView in that, thus I created a partial view to pass a specific model to that view. Now I'm trying to render that specific view into my section - but the section stays empty.

This does not work:

@section Left {
    @Html.Partial("PartialNavigationView")
}

And rendering the thing returns an error Expression must return a value to render :

@section Left {
    @Html.RenderPartial("PartialNavigationView")
}

How can I render a partial view into my section?

Try

@{Html.RenderPartial("PartialNavigationView");}

or

@{Html.Partial("PartialNavigationView");}

should work also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM