ho converted my project da MVC 1 a MVC 2 e Visual Studio 2008 mi dà il seguente errore:MvcHtmlString MVC 2 Conversione errore
Error 1 'System.Web.Mvc.MvcHtmlString' does not contain a definition for 'Substring' and no extension method 'Substring' accepting a first argument of type 'System.Web.Mvc.MvcHtmlString' could be found (are you missing a using directive or an assembly reference?) C:\Dev\SapientFansite\SapientFansiteApplication\SapientFansiteWeb\Code\ExtensionMethods\Html.cs 68 75 SapientDevelopment.SapientFansite.Web
ecco il codice l'errore sta puntando. In particolare ha problemi con "linkHtml.Substring (0, 2)".
var linkHtml = htmlHelper.ActionLink(linkText, actionName, controllerName);
if (isActiveMenuItem) {
linkHtml = string.Format("{0} class=\"active\" {1}", linkHtml.Substring(0, 2), linkHtml.Substring(3));
}
return linkHtml;
}
Sospetto che abbia qualcosa a che fare con un riferimento mancante o qualcosa del genere ma sono in perdita.
Grazie, questo ha fatto il trucco. Sembra che ActionLink abbia fatto una veloce su di me. :) –