Question Why will ActionLink not take a variable piece of data for id?

groadsvb

Well-known member
Joined
Nov 13, 2006
Messages
75
Programming Experience
Beginner
I am learning MVC and am using VB.net presently. I am trying to put a variable piece of data as the id of request to my controller with the ActionLink Helper but visual studio is preventing me from doing so. I thought the @curItem.scoutID was an expression, but the error I get when I hover over is "Expression expected". Thanks.
Code:
   @Html.ActionLink("Details", "Detail", New With {.id = @curItem.scoutID})
 

groadsvb

Well-known member
Joined
Nov 13, 2006
Messages
75
Programming Experience
Beginner
I got it to work. Quite simple actually but I tried a lot of things, especially writing an extension helper that did not work. below is what worked I removed the @ before the curItem :
@Html.ActionLink("Details", "Detail", New With {.id = curItem.scoutID})
 
Top Bottom