1

So I want to put a list of newsitems in _Layout.cshtml
I have a News model and a Show Action in its controller, and I want to put it in there with a RenderAction.

@Html.RenderAction("Show","News");

Does not seem to work. But http://localhost:49295/News/Show/ does work I should be using renderaction right?

EDIT

@{Html.RenderAction("Show","News");}

stackoverflowerror, probably because I just put an action that uses the layout, in the layout itself? How do I not use the default layout for this view?

DasRakel
  • 73
  • 7
  • "Does not seem to work" => what happens? The part in question is just not rendered or do you get an exception? In case of an exception what is the message / stack trace? – Tz_ Jun 29 '11 at 15:48

2 Answers2

4

Set the layout to null in the View

@{ Layout = null; }
Tz_
  • 2,949
  • 18
  • 13
0

In your View try:

@{Html.RenderAction("Show","News");}
Chris
  • 3,191
  • 4
  • 22
  • 37