I have a class named InvoiceLine which has the following properties.
public class InvoiceLine : IEntity
{
...
public virtual int? OfficeUserId { get; set; }
public virtual int? FieldUserId { get; set; }
public virtual bool? OfficeApproved { get; set; }
public virtual string OfficeRejectionReason { get; set; }
public virtual DateTime? OfficeApprovedDate { get; set; }
public virtual bool? FieldApproved { get; set; }
public virtual string FieldRejectionReason { get; set; }
public virtual DateTime? FieldApprovedDate { get; set; }
...
public virtual User OfficeUser { get; set; }
public virtual User FieldUser { get; set; }
...
}
I want to display in a table something like:
<td>Office sign off: Conan the Barbarian Approved</td>
<td>Field sign off: Steve the snake Not Approved</td>
So I wrote:
<td>Office sign off:
@Html.DisplayFor(modelItem => invoiceLine.OfficeUser.UserName)
@Html.DisplayFor(modelItem => invoiceLine.OfficeApproved)
</td>
<td>Field sign off:
@Html.DisplayFor(modelItem => invoiceLine.FieldUser.UserName)
@Html.DisplayFor(modelItem => invoiceLine.FieldApproved)
</td>
Obviously this doesn't give the required format and delivers something like:
<td>
Office sign off: Conan the Barbarian
<select class="tri-state list-box" disabled="disabled">
<option value="">Not Set</option>
<option value="true" selected="selected">True</option>
<option value="false">False</option>
</select>
</td>
<td>
Office sign off: Steve the snake
<select class="tri-state list-box" disabled="disabled">
<option value="">Not Set</option>
<option value="true">True</option>
<option value="false" selected="selected">False</option>
</select>
</td>
So I'm getting the boolean values for the approvals in dropdownlists which makes sense. How to I get it to display instead as I described earlier?