• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

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