It's hard to tell from your post - suspect the forum has messed up your code but I don't think you need the @ before the if statement.
You only need this when you're mixing razor with HTML - I like to think of it as putting the view into "code mode". If you're already in a code block like:
@{
// this is a code block
}
Then don't prefix code with @ - it's for mixing in with Html like:
if statemente in partial view
hallo i wrote this partial view to test remote address:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ string currentURL = ""; var ParzialUrl="";
currentURL = Request.ServerVariables["REMOTE_ADDR"];
ParzialUrl=currentURL.Substring(0,7);
@if(ParzialUrl=="100.00.") {
TEST
} }===> the statement IF does't work, How i can do it???
Hi,
It's hard to tell from your post - suspect the forum has messed up your code but I don't think you need the @ before the if statement.
You only need this when you're mixing razor with HTML - I like to think of it as putting the view into "code mode". If you're already in a code block like:
Then don't prefix code with @ - it's for mixing in with Html like:
thanks, this is my whole code:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{
@if(ParzialUrl=="172.20.") {
TEST URL
}}
What is wrong???
Remove the '@' from the if.
It Works! Thanks!!!
is working on a reply...