This is a weird issue, and I don't know if Umbraco is at fault or Razor. This is basically what I have:
@{
Layout = null;
var home = @CurrentPage.Site();
string url = "";
if (true == true)
{
url = "test";
}
else if (true == false)
{
url = "test";
}
}
Obviously changed out my if-statements. This is valid (although it never gets past the first if-statement) and should work, but I get an:
} expected
when I try to run it. If I do this, however, it works fine:
@{
Layout = null;
var home = @CurrentPage.Site();
string url = "";
}
@{
if (true == true)
{
url = "test";
}
else if (true == false)
{
url = "test";
}
}
Why do I need to make a completely new @{} code block to get rid of this error? Visual Studio just fails to format my code (but it's not invalid), yet I get the error when I try to display the page.
BUG: } expected if inside first block @{}
This is a weird issue, and I don't know if Umbraco is at fault or Razor. This is basically what I have:
Obviously changed out my if-statements. This is valid (although it never gets past the first if-statement) and should work, but I get an:
when I try to run it. If I do this, however, it works fine:
Why do I need to make a completely new
@{}
code block to get rid of this error? Visual Studio just fails to format my code (but it's not invalid), yet I get the error when I try to display the page.Razor, Umbraco, or my mistake?
Hi Morten,
you can also remove the @ from CurrentPage like:
/Michaël
God dammit, that seems to be the issue.
Thanks a lot haha!
Damn, sorry for creating this inside the Vorto subforum. That was definitely not my intention!
is working on a reply...