简体   繁体   中英

Access a PartialView's Model in a View which implements that PartialView

How can you access a PartialView's model, in a View which implements that PartialView?

I'm thinking something along the lines of: Page.FindControl("PartialView-name").Model .

A partial view (.ascx) is included from a view (.aspx). If this partial is strongly typed you pass the model from the view so you already have access to it:

<% Html.RenderPartial("~/Views/Shared/SomePartial.ascx", SomeModel); %>

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