scv
scv

Reputation: 363

@Html.Action In Layout Page

Thanks for reading this.

In the _Layout.cshtml page I use the @RenderPage to call the header:

@RenderPage("/Shared/_header.cshtml")

It has this:

<div id="Header"> Home </div>

Want to make it clickable to the default action ("Index")

When I tried this:

<div id="Header"> @Html.Action("Index", MyController") </div>

I get the error:

An opening "(" is missing the corresponding closing ")" at

@RenderPage("/Shared/_header.cshtml")

Any idea?

Upvotes: 1

Views: 3365

Answers (1)

Miroslav Popovic
Miroslav Popovic

Reputation: 12128

You are missing the opening double-quote on MyController.

It should be:

<div id="Header"> @Html.Action("Index", "MyController") </div>

Upvotes: 2

Related Questions