Aar*_*zar 9 model-view-controller asp.net-mvc-2
我将我的项目从MVC 1 转换为MVC 2,Visual Studio 2008给出了以下错误:
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
Run Code Online (Sandbox Code Playgroud)
这是错误指向的代码.特别是"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;
}
Run Code Online (Sandbox Code Playgroud)
我怀疑它与缺少的参考或某事有关,但我不知所措.
| 归档时间: |
|
| 查看次数: |
7531 次 |
| 最近记录: |