[英]Problem setting up T4MVC and MVC 2
我正在網站上為MVC 2設置T4MVC。 我收到2個構建錯誤:
方法'RenderAction'的重載在T4MVC.cs中采用3個參數
和
T4MVC.cs中的方法'Action'不重載3個參數
這些是T4MVC.cs文件中的文件:
public static void RenderAction(this HtmlHelper htmlHelper, ActionResult result) {
var callInfo = result.GetT4MVCResult();
htmlHelper.RenderAction(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
}
public static MvcHtmlString Action(this HtmlHelper htmlHelper, ActionResult result) {
var callInfo = result.GetT4MVCResult();
return htmlHelper.Action(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
}
謝謝
這很奇怪,因為這些重載存在於System.Web.Mvc.Html.ChildActionExtensions(它是MVC的一部分)中:
public static class ChildActionExtensions {
public static MvcHtmlString Action(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues);
public static void RenderAction(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues);
}
在T4MVC.cs的頂部,應該有一個“ using System.Web.Mvc.Html”,這使這些擴展方法可用。
您是否可以在自己的代碼中調用相同的重載?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.