c# - MVC Razor Actionlink issue with routevalue -


i trying actionlink following code :

@html.actionlink("home", "list", "product",     new {         @class = horizontal ? "btn btn-default btn-sm" :             "btn btn-block btn-default btn-lg"     }) 

however gives me error unless add null routevalues before html attributes. can't figure out why so. mvc version issue or perhaps i'm referencing wrong dll somewhere ?

please assist. following sportsstore example application adam freeman(apress) , code doesn't have null routevalues , apparently works.

there few overloads actionlink. 1 need this one:

public static mvchtmlstring actionlink(     htmlhelper htmlhelper,     string linktext,     string actionname,     string controllername,     object routevalues,     object htmlattributes ) 

you trying pass anonymous object of htmlattributes. match signature routevalues needs contain value (null in case). there no overload 3 strings , 1 object parameter, therefore error.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -