I need to generate multi CSS class names in a view using Razor, however Razor treats white space a bit tricky
<footer [email protected](false,"footer","footer footer--no--border">
</footer>
My helper method:
public static string TruthyValueSelector(bool condition, string firstParameter, string secondParameter)
{
if (condition)
return $"{firstParameter}";
return $"{secondParameter}";
}
when I inspect the element, the footer css class is: class="footer" footer--no--border=""
Of course, this is not going to work. My attempts in handling this situation cleanly with C# and Razor has not been successful. How can I take care of this in Razor?
(this HtmlHelper<T> html, ...as the first parameter.TruthyValueSelectorbeing invoked? Put a debug point to validate if the method is called.return firstParameter;orreturn secondParameter;.