In my controller, I have and inline If statement:
ViewBag.NameSortParam = If(String.IsNullOrEmpty(sortOrder), "Name desc", "")
In my view, I can't seem to use inline if:
@Code
If(True, true, true)
End code
It says, "If must end with matching End If." Why can't I use an inline if here? Thanks.
You can do an inline if in vb.net like this:
@(If(testExpression, TruePart, FalsePart))
Try
@Code
@(If(True, true, true))
End Code
You could use something like this:
@(true? "yes": "no")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With