I'm using the Html.Truncate function from the MvcMusicStore tutorial (page 5
) and I want to use it in a Webgrid column to trim some text. However I can't get the syntax correct to get the Html.Truncate function to work with a string in my Webgrid. My (now experimental) Webgrid looks like this:
var grid = new WebGrid(Model, canPage: true, canSort: true);
grid.Column("Comment", "Comment1", format: @<text>@Html.Truncate("Test string", 4)</text>),
grid.Column("Comment", "Comment2", format: @<text>@Html.Truncate(@item.Comment, 8)</text>),
grid.Column("Comment", "Comment3", format: @<text>@item.Comment</text>)
The code for column "Comment1" and "Comment3" is working but the code in "Comment2" is not working. The error message I get is
Description: An error occurred during the compilation of a resource required to service this request.
Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for
View Complete Post