razor - ActionLink doesn't work -
razor - ActionLink doesn't work -
i'm pretty sure i'm doing stupid. please have , allow me know i'm doing wrong.
here actionlink
@html.actionlink("edit","edit","userprofile", new { id = model.applicationuserid },null)
when click throws bad request exception , noticed url
https://localhost:44304/userprofile/edit/92b1347c-c9ec-4728-8dff-11bc9f935d0b
not
https://localhost:44304/userprofile/edit?userid=92b1347c-c9ec-4728-8dff-11bc9f935d0b
i have httpget
edit method in controller , takes userid
. when pass route values manually works.please help me. help much appreciated , someday, pay forward. thanks! cheers!
if parameter expecting userid
, utilize @html.actionlink
this:
@html.actionlink("edit","edit","userprofile", new { userid = model.applicationuserid },null)
if pass parameter name id
, mvc route mentioned:
https://localhost:44304/userprofile/edit/92b1347c-c9ec-4728-8dff-11bc9f935d0b
which great, method should expecting parameter appropriate name:
// get: /userprofile/edit/{id} public actionresult edit(string id){ //your code homecoming view(); }
if have time, check out asp.net mvc routing overview lot more details.
hope helps.
razor asp.net-mvc-5
Comments
Post a Comment