Results 1 to 2 of 2

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

  1. #1
    groadsvb is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Nov 2006
    Posts
    75
    Reputation
    130

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

    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})
    GAR

  2. #2
    groadsvb is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5
    Join Date
    Nov 2006
    Posts
    75
    Reputation
    130
    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})
    GAR

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •