mardi 7 février 2017

How to send string id to controller using actionlink

i am tring to have links link this /View/test it is working only if it is int like /View/1

my view action link

   @Html.ActionLink(item.className, "View", "subject", new {id =item.className  },null)

my control action

       public ViewResult View(string id)
        //some database
        return View();

i get this error Server Error in '/' Application. if i change the id into anything it works fine but the link will looks like this : View?anything=par

Aucun commentaire:

Enregistrer un commentaire