Find Area name and Controller Name in custom Htmlhelper with ASP.NET MVC3

后端 未结 3 1141
情深已故
情深已故 2021-02-08 12:10

I try to rewrite and customize @Html.ActionLink, in one of overloads of this method the parameters are:

public static MvcHtmlString ActionLink(this         


        
3条回答
  •  故里飘歌
    2021-02-08 12:27

    I believe "controller" and "area" should be lower case. Here is how to get the area value:

    ASP.NET MVC - Get Current Area Name in View or Controller

    If not currently in an area it would give a object reference exception, so check for null first and then set the value if it is not null. Your controller is also correct, just try it in lower case. Hope this helps

提交回复
热议问题