I have some razor code and I am having a problem with getting the syntax working. The code is as follows:
else
{
@(x.RowKey.Substring(0, 2).TrimStart('0') + "." + x.RowKey.Substring(2, 2).TrimStart('0').PadLeft(1, '0')) - @Html.Raw(x.Title)<br>
}
This is giving me the following error:
Compiler Error Message: CS1002: ; expected
When you start your
@(x.RowKey...., Razor still thinks that it’s still in C# mode, not HTML mode (to use the totally non-technical terms). Nick Bork’s suggestion about wrapping that stuff in the<text>tags gets the page back into HTML mode so you can go back to using your normal Razor syntax.