I have this:
<tr class="@(item.Id == (int)(Session["Id"] ?? 0) ?
"sfs-selected sfs-selectable" : String.Empty)">
but I get this meesage:
operator '==' cannot be applied to operands of type 'method group' and 'int'
but I already cast to int.
If I do this:
<tr class="@if (item.Id == (string)(Session["id"] )) {@("sfs-selected sfs-selectable") } @string.Empty ">
then I get this error:
Unable to cast object of type 'System.Int32' to type 'System.String'.
So how to check on null value?
Thank you
if I do this:
<tr class="@(item.Id == (Session["Id"] ?? 0) ? "sfs-selected sfs-selectable" : String.Empty)">
I get this warning:
Warning as Error: Possible unintended reference comparison; to get a value comparison, cast the right hand side to type 'string'
So I do this:
<tr class="@(item.Id == (string)(Session["Id"] ?? 0) ? "sfs-selected sfs-selectable" : String.Empty)">
then I get this:
Unable to cast object of type 'System.Int32' to type 'System.String'.