Mesut
Mesut

Reputation: 1875

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...

Upvotes: 13

Views: 18489

Answers (1)

Kundan Singh Chouhan
Kundan Singh Chouhan

Reputation: 14302

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

Upvotes: 8

Related Questions