locked
Adding 'Edit' link in WebGrid RRS feed

  • Question

  • User-1862500537 posted

    I'm following this tutorial http://www.asp.net/web-pages/overview/getting-started/introducing-aspnet-web-pages-2/updating-data but using VB so I get to this part:

    @grid.GetHtml(
    tableStyle: "grid",
    headerStyle: "head",
    alternatingRowStyle: "alt",
    columns: grid.Columns(
        grid.Column(format: @<a href="~/EditMovie?id=@item.ID">Edit</a>),
        grid.Column("Title"),
        grid.Column("Genre"),
        grid.Column("Year")
        )
    )

    And I think this is the equivalent code using VB:

    @grid.GetHtml(
    tableStyle:="grid",
    headerStyle:="head",
    alternatingRowStyle:="alt",
    columns:=grid.Columns(
        grid.Column(format:=@<a href="~/EditMovie?id=@item.ID">Edit</a>),
        grid.Column("Title"),
        grid.Column("Genre"),
        grid.Column("Year")
        )
    )

    But I get an error in 'format:=@' can someone please tell me why I have that error?

    Monday, July 4, 2016 9:58 PM

Answers

  • User-821857111 posted

    VB requires two @ signs in the format parameter:

    grid.Column(format:=@@<a href="~/EditMovie?id=@item.ID">Edit</a>),
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 5, 2016 7:07 AM

All replies

  • User-821857111 posted

    VB requires two @ signs in the format parameter:

    grid.Column(format:=@@<a href="~/EditMovie?id=@item.ID">Edit</a>),
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 5, 2016 7:07 AM
  • User-1862500537 posted

    That was simple, Thank you Mikesdotnetting I learn something new =)

    Tuesday, July 5, 2016 2:43 PM