2
votes

I saw this line of code from a sample application:

grid.Column(format: @<a href="~/[email protected]">Edit</a>)

The complete snippet looks like this:

@grid.GetHtml(
   tableStyle: "grid",
   headerStyle: "head",
   alternatingRowStyle: "alt",
   columns: grid.Columns(
      grid.Column(format: @<a href="~/[email protected]">Edit</a>),
      grid.Column("Title"),
      grid.Column("Genre"),
      grid.Column("Year")
  )
)

It's supposed to render a column with the Edit hyperlink.

I'm new to Razor and the webgrid. Could someone please explain how that line of code works. The code is in C#.

2

2 Answers

0
votes
grid.Column(format: @<text><a href="@Url.Action("EditMovie","ControllerName",new { [email protected] })">Edit</a></text>)
-1
votes
grid.Column(header: "Edit", format: @<text><a href="@Url.Action("Edit", "Controllername", new {ID = item.CompanyID })" ><img src="../../../../Content/images/edit.png" alt="" style="border:none;" /></a></text>, style: "colOperation"),