hncl
hncl

Reputation: 2295

Asp.net MVC / MVC2

This script works well in MVC 1, however I get "invalid arguments error" in MVC2: this.menuItems.Add("action", Html.ActionLink("action", "view", "Controller"));

Upvotes: 0

Views: 92

Answers (1)

jordanbtucker
jordanbtucker

Reputation: 6078

In MVC2, ActionLink returns an MvcHtmlString, and menuItems.Add likely expects a string. So this should work:

this.menuItems.Add("action",
  Html.ActionLink("action", "view", "Controller").ToString());

Upvotes: 1

Related Questions