<div id="SideNav"> <div id="Content"> Here is some content </div> </div>
</div>
As you can see I want a different DIV output depending if the user is logged in or not.
However I cannot save this .cshtml file as I get this error.
Error occured The if block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}"
characters are being interpreted as markup.
Missing what? I just can't see what the problem is here.
That's not what I have planned.. I need to show the SideNav content regardless, but I need a different div with different styles around it depending on the users logged in state.
So the structure of what I have is correct, it is just a syntax issue.
"Hide" in this case will just mean that certain items are rendered as disabled and have a different style applied, but that is not the issue at hand here.
What did you mean by "the way you are calling your script"? This is a pretty standard .cshtml file that is put into a Macro and is loaded into a page template.
What is wrong with this Razor?
I have created a new .cshtml file in my Developer/Scripting Files folder.
The content of this file thus far is this.
As you can see I want a different DIV output depending if the user is logged in or not.
However I cannot save this .cshtml file as I get this error.
Missing what? I just can't see what the problem is here.
Hi Brad,
No you are not missing a "}" here!! its only the way you are calling you script
But in any case i dont think you really need the else statement here if you are planning to hide content
//fuji
That's not what I have planned.. I need to show the SideNav content regardless, but I need a different div with different styles around it depending on the users logged in state.
What I need to end up with is this...
Or this..
So the structure of what I have is correct, it is just a syntax issue.
"Hide" in this case will just mean that certain items are rendered as disabled and have a different style applied, but that is not the issue at hand here.
What did you mean by "the way you are calling your script"? This is a pretty standard .cshtml file that is put into a Macro and is loaded into a page template.
Hi Brad,
What i meant was there was a missing closing div inside your @if.
Did you get it working though ?
Hi Brad,
You could do something like this:
/Carsten
Carsten
Elegant solution. Thanks for that.
Just curious, any idea why my code did not work?
is working on a reply...