In Razor v2, we are not able to use @this inside razor code block. For example, if we use this in Razor V2 then the parser shows a parser error.
@if (this.Model.ShowAddButton)
{
@this.Html.ActionLink("Add", "Add")
}
Detail can be found here.
http://forums.asp.net/t/1844029.aspx
Comments: A workaround can be putting a statement into a brackets: @(this.Html.ActionLink("Add", "Add")) But this is a bug in my opinion and should be repaired.
@if (this.Model.ShowAddButton)
{
@this.Html.ActionLink("Add", "Add")
}
Detail can be found here.
http://forums.asp.net/t/1844029.aspx
Comments: A workaround can be putting a statement into a brackets: @(this.Html.ActionLink("Add", "Add")) But this is a bug in my opinion and should be repaired.