13

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

KaraKaplanKhan
  • 734
  • 1
  • 14
  • 31
Mesut
  • 1,845
  • 4
  • 24
  • 32

1 Answers1

8

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

Community
  • 1
  • 1
Kundan Singh Chouhan
  • 13,952
  • 4
  • 27
  • 32
  • @Mesut, so do you need some other thing? – Kundan Singh Chouhan Oct 13 '12 at 18:26
  • Yes, Suppose that I've two works to do. Such as tables are in a.cshtml and div's are in b.cshtml. But When I call action it combines two of razor pages, and gives me only one output. No RenderPartial or RenderPage methods. Because my main purpose is getting intellisense of a.cshtml while in b.cshtml. Again suppose that I initialized a variable called "customers" in a.cshtml, then I'd like to see this at b.cshtml's intelli sense. – Mesut Oct 14 '12 at 06:50
  • 6
    @Mesut, why didn't you put that in the question? – Emond Oct 14 '12 at 08:35