0
我有以下的自定義幫助:定製MVC HTMLHelpers在剃刀VB.NET
<Extension> _
Public Function ActionLinkAuthorized(htmlHelper As HtmlHelper, linkText As String, actionName As String, controllerName As String, routeValues As RouteValueDictionary, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString
If (Roles.IsUserInRole("Administrator")) Then
Return htmlHelper.ActionLink(linkText, actionName, controllerName, routeValues, htmlAttributes)
Else
Return MvcHtmlString.Empty
End If
End Function
這可以看出,在我的Razor視圖精細和我嘗試按如下方式使用它:
@Html.ActionLinkAuthorized("Edit", "Edit", "Account", New With {.id = currentItem.Id}, htmlAttributes:=New With {.class = "btn btn-warning", .title = "Edit"})
但是在運行我的應用程序時出現以下錯誤:
類型'(行193)'的值無法轉換爲'System.Web.Routing.RouteValueDictionary'。
我完全是VB.NET的新手,不太清楚自己做錯了什麼。非常感激任何的幫助。