2010-04-29 36 views
0

我在我的網站上爲MVC 2設置T4MVC。我得到2個編譯錯誤:設置T4MVC和MVC 2的問題

無重載方法 '的RenderAction' 3個參數中T4MVC.cs

無重載方法 '行動' 3個參數中T4MVC.cs

這些都是在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); 
    } 

謝謝

回答

1

真奇怪,在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的頂部,應該有一個「使用系統.Web.Mvc.Html',它使這些擴展方法可用。

你能夠在你自己的代碼中調用那些相同的重載嗎?

+0

我下載了最新版本的MVC 2並獲得了ChildActionExtensions。猜猜我有某種MVC 2的RC/Beta版。 謝謝 – knepe 2010-04-30 14:58:41