c# - How to pass String in Querystring Parameter in @Html.ActionLink -


i have written following code:

@html.actionlink("edit", "editpost", new { id = item.postid }) 

it displays url .../post/editpost/32 want display ...../post/editpost?id=32

how possible in razor view???

the url construct dictated route, if want force use query string remove notion of parameter e.g.

routes.maproute(     "editpostroute",     "post/editpost",     new { controller = "edit", action = "editpost" } ); 

your @html.actionlink code should generate .../post/editpost?id=32.


Comments