I'm quite confused in Razor syntax ))) For example I have an element:
<div class="category-block">
</div>
I have a parameter
string viewMode = Html.ViewContext.HttpContext.Request.QueryString["view"];
and I need to add list-block
class to my div element with class category-block
and to get
<div class="category-block list-block">
</div>
if
viewMode != null && viewMode.Equals("list", StringComparison.OrdinalIgnoreCase)
.
I trie to do something like:
<div class="category-block @(viewMode != null && viewMode.Equals("list", StringComparison.OrdinalIgnoreCase)) ? list-block : string.Empty ">
but every time I get a lot of syntax errors... I don't know is it possible to write something inside opened attribure brackets;