Reputation: 2629
I read the docs and apparently this should be acceptable:
@{
string isDisplay = "";
if (@ViewBag.Name == "" || @ViewBag.Name == null)
{
isDisplay ="display:none;";
}
}
it's giving me a compliation error however though:
this is the error: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1501: No overload for method 'Write' takes 0 arguments
any ideas?
Upvotes: 0
Views: 1863
Reputation: 6111
I don't have the compiler on hand, but this should be better
@{
string isDisplay = "";
if (ViewBag.Name == "" || ViewBag.Name == null)
{
isDisplay ="display:none;";
}
No need for the @ sign in a Razor Block
Upvotes: 2