I m working on a MVC 3 webgrid at the moment, in one of the columns I wish to have a button, I ve achieved this when putting the following code in the view.
@grid.GetHtml(columns:
grid.Columns(
grid.Column("ID", "id", canSort: true),
grid.Column("Surname", "surname", canSort: true),
grid.Column("Forenames", "forename", canSort: true),
grid.Column(format: @<input type="button" value="View"/>)),
headerStyle: "header",
alternatingRowStyle: "alt",
htmlAttributes: new { id = "DataTable" }
)
However I wish to create the grid server side for the purpose of paging, but when I put the code below in the action I get a error for for the button column.
var htmlString = grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
htmlAttributes: new { id = "DataTable" },
columns: grid.Columns(
grid.Column("ID", "id", canSort: true),
grid.Column("Surname", "surname", canSort: true),
grid.Column("Forenames", "forename", canSort: true),
grid.Column(format: @<input type= button value= View />)
));
The first error is "Keyword, identifier, or string expected after verbatim specifier: @".
Am I using the incorrect format on the button column?