我剛剛將我的ASP.Net MVC項目從MVC 2.0 Preview 2遷移到MVC 2.0 Beta,並且我對Html.RenderAction的調用打破了,因爲在MVC 2.0中引入了新的RenderAction方法Beta版。ASP.Net 2.0和新的RenderAction方法
在下面一行:
<% Html.RenderAction("DisplayIMHandles", "UserProfile", new { userProfileId = Model.Id }); %>
我收到以下錯誤:
<% Microsoft.Web.Mvc.ViewExtensions.RenderAction
(this.Html, "DisplayIMHandles", "UserProfile", new { userProfileId = Model.Id }); %>
:
Compiler Error Message: CS0121: The call is ambiguous between the following methods or properties:
'System.Web.Mvc.Html.ChildActionExtensions.RenderAction(System.Web.Mvc.HtmlHelper, string, string, object)' and 'Microsoft.Web.Mvc.ViewExtensions.RenderAction(System.Web.Mvc.HtmlHelper, string, string, object)'
我可以用任何的這2個替代品取代線解決問題
或
<% System.Web.Mvc.Html.ChildActionExtensions.RenderAction
(this.Html, "DisplayIMHandles", "UserProfile", new { userProfileId = Model.Id }); %>
我應該使用哪兩種,有什麼區別?另外,有沒有辦法解決這個問題,而不寫整個命名空間,就像我曾經擁有它?
預先感謝您。