0

It seems that the ViewBag.Title & @RenderSection(..) executes multiple times but i can't figure why it happens

this is a new project, i have just implemented a single controller with a single view the Index.cshtml contains

@{
   ViewBag.Title = "Index";
   Layout = "~/Views/Shared/_Layout.cshtml";
}

and the layout:

enter image description here

Thanks in advance :)

2
  • Note that it's probably best to copy-paste the code and exception (indicating where the exception occurred) in future so people searching using the error message (for example) can easily find this question. :) Commented Jul 27, 2012 at 10:37
  • @George Duckett Ok i'll keep it in mind, thanks :) Commented Jul 27, 2012 at 10:42

1 Answer 1

1

Buried beneath your screenshot I can perceive the root of your problem:

<a href="@Html.Action("Inde........
    <img src="~/Content/ima....
</a>

You wanted to use Url.Action and not Html.Action which is something entirely different.

<a href="@Url.Action("Inde........
    <img src="~/Content/ima....
</a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.