What error do you get? And what version of Umbraco are you using? It may be a bug that's the cause since there have been some issues in Umbraco 6 razor implementation I think.
Ok, are you then using MVC or still webforms? There is a difference in the Razor implementation wether you're using the one or the other. However I think it would be weird if the syntax elements would differ...so it could perhaps also be a minor bug that's the cause. I know there have been some bugs with the implementation unfortunately.
I'm sure it's as consistent as it can be - and the core concepts are the same. But the mvc implementation differs as there are more things that can be done as far as I know. (I'm still a bit of a Razor n00b - xslt is still more my thing) :)
V6 does use Razor V2 for both webforms and MVC, there have been some syntax changes, not many, but enough to stop some code that worked in say 4.7 from working in newer versions.
One change is, in a code block @{} you should not need additional @, this breaks the block, hence you need to close it, therefore your error of expected } is correct.
If you check with Visual Studio, as all of your code is in a block, the var when called if (@linkUrl == "") , you should be able to remove this @, too.
Have been searching for some documentation on razor V2, but without anything that really explains what is relevant to us here in Umbraco.
For the record, I now don't enter the @ until Visual Studio says it doesn't like it without, especially as the @ is Ctrl+alt+2 on my keyboard and curly braces Ctrl+alt+7 and Ctrl+alt+0, if I can enter them once each, its all good.
Razor error depending for curly brace
I'm getting this error depending on where I move an <a> markup, does anyone know why this would happen?
No error:
Error:
Hi Amir
What error do you get? And what version of Umbraco are you using? It may be a bug that's the cause since there have been some issues in Umbraco 6 razor implementation I think.
Looking forward to hearing from you.
/Jan
Hi Jan, it is version 6.0, I was able to fix it by dropping the "@" before Model. It seems odd that it would fail with "error CS1513: } expected".
Here's the updated code that works:
Hi Amir
Ok, are you then using MVC or still webforms? There is a difference in the Razor implementation wether you're using the one or the other. However I think it would be weird if the syntax elements would differ...so it could perhaps also be a minor bug that's the cause. I know there have been some bugs with the implementation unfortunately.
/Jan
Hi Jan, using webforms.
Seems to me like consistency should be the key as I suspect people will be jumping between project that use each.
-Amir
Hi amir
I'm sure it's as consistent as it can be - and the core concepts are the same. But the mvc implementation differs as there are more things that can be done as far as I know. (I'm still a bit of a Razor n00b - xslt is still more my thing) :)
/Jan
Yeah, makes sense. Just lots of changes going on, there's bound to be some roadbumps on the way.
Hi Amir
V6 does use Razor V2 for both webforms and MVC, there have been some syntax changes, not many, but enough to stop some code that worked in say 4.7 from working in newer versions.
One change is, in a code block @{} you should not need additional @, this breaks the block, hence you need to close it, therefore your error of expected } is correct.
If you check with Visual Studio, as all of your code is in a block, the var when called if (@linkUrl == "") , you should be able to remove this @, too.
Have been searching for some documentation on razor V2, but without anything that really explains what is relevant to us here in Umbraco.
For the record, I now don't enter the @ until Visual Studio says it doesn't like it without, especially as the @ is Ctrl+alt+2 on my keyboard and curly braces Ctrl+alt+7 and Ctrl+alt+0, if I can enter them once each, its all good.
Hope it helps a bit, sorry cannot be more precise
regards G
is working on a reply...