I am trying to do some iterative logic in a razor view. I have a very simple do while loop:
@do{
@{parent = parent.Parent}
}while(parent != null);
However the line
@{parent = parent.Parent}
Causes the following error:
[Exception: No overload for method 'Write' takes 0 arguments]
Any ideas?
You forgot a
;:But because you are already inside the Razor block of the
dooperator it is not necessary to wrap your expression in yet another@{}.