简体   繁体   中英

How to include a razor page to another razor page?

I'd like to know how to include another razor page in running razor view just as PHP's "include" term. It can be considered as partial classes. Half of work is done at a.cshtml and the other half of works are done at b.cshtml. But in reality two of them are built as one razor page.

Any ideas will be appreciated...

You can use Partial Views in MVC.

Try RenderAction or RenderPartial methods to render another view or partial view in a current view.

More Reference :

RenderAction RenderPartial

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

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