I’d like to have this html code where a condition (“myBool”) is true :
<div>
<fieldset>
<legend>
@sometext
</legend>
... other stuffs
</fieldset>
<div>
and this one when it’s false :
<div>
<b>
@sometext
</b>
... other stuffs
<div>
I dont what to whave to write se same code (“other stuffs”) twice so I tried this :
<div>
@if(myBool)
{
<fieldset>
<legend>
}
else
{
<b>
}
@sometext
if (myBool)
{
</legend>
}
else
{
</b>
}
...other stuff
if (myBool)
{
</fieldset>
}
</div>
but I get compilation errors.
Do you see how I could do what I want without having to do somethig like that :
@if(myBool)
{
<div>
<fieldset>
<legend>
@sometext
</legend>
... other stuffs
</fieldset>
<div>
}
else
{
<div>
<b>
@sometext
</b>
... other stuffs
<div>
}
Thank you.
The following might work using the
@:operator.When you’re inside a code block, either because of a control structure (like in the example given below) or because you have explicitly defined one, you can output plain text by prefixing with a @-character followed by a : (colon) character.
or you might also try the following: