Search code examples
asp.netasp.net-mvcrazorwebgrid

Calculate a value for a column in a WebGrid


I'm trying to calculate a column value using two properties of the DataSource. This is my column:

grid.Column(header:"Duration", format:@<text>@{((TimeSpan)(item.EndTime - item.StartTime)).TotalMilliseconds}</text>)))

I keep getting an HTTPCompileException when I try to navigate to this grid. Why is it unhappy with this?


Solution

  • Needed to remove the {} from the format block.