I am using asp.net mvc and I have a table with value. When the customer paid value = 0. I want it to display No payment in the cell. When it Customer paid = 1. I want it to display. Pending. When it = 2 i want it to display Paid.
I am attempting to write an inline code block to display payment status based on the value of the Paid property on my Customer class. If the value is “0”, I need to display an empty cell. If the value is “1” I need to print “Pending” into the cell, and if the value is “2” I need to print “Paid”.
I have the following already, but I am not sure how to get the value into the cell.
<%foreach (var Customer in CustomerList) {%>
<tr>
<td><input type="radio" value="<%= Customer.ThirdPartyCustomerId %>" /></td>
<td><%=Customer.FirstName%></td>
<td><%= if(Customer.Paid==0)
{
Customer.Paid== "No Payment";
};%>
</td>
</tr>
<%}%>
I’m no ASPX expert, but wouldn’t this work?
or, if you want it in one line