Home > Enterprise >  Iam trying to use Html.ActionLink to generate url with queryString parameter at the end of it
Iam trying to use Html.ActionLink to generate url with queryString parameter at the end of it

Time:01-26

I am trying to use Html.ActionLink to generate URL with query String parameter at the end of it like:

Controller/Action?id=5

But what i get is:

Controller/Action/5

Using :

@Html.ActionLink((string)ViewBag.Back, "Action", "Controller", new{id = Model.Id }, new { })

How can i pass the id parameter as "?id=" not after "/" Thanks

CodePudding user response:

change action header

public ActionResult Details(int? detailsId)

and adjust link

Html.ActionLink((string)ViewBag.Back, "Action", "Controller", new{detailsId = Model.Id }, new { })
  •  Tags:  
  • Related