With javascript, in asp.net grid view am switching the displaying boolen value to string as follow
<asp:Label ID="Correct" Text='<%# Eval("Correct").ToString().Equals("true") ? " Correct " : " Wrong " %>' runat="server"/></td>
is there any way to switch 3 different values if datatype is int & values are 1,2 & 3 to show respectively low, medium & high. I have tried as follows but its not working
<asp:Label ID="Difficulty" Text='<%# Eval("Difficulty").ToString().Equals("1") ? " low" : (("Difficulty").ToString().Equals("2") ? " medium " : " high ") %>' runat="server"/></td>
Even if this can be done with ternary operator – it is extremely hard to read. I’d say your best bet would be defining a function in corresponding code behind class:
And then calling it in the markup: