I have HelpBoxes in my DB. those are messages people get on the site. each message has a receiver. either it's an organisation or a user, or both.
I have this Enum
public enum Ontvangers {
All = 'A',
Organisation = 'I',
User = 'D'
}
now in my index view
public ActionResult Index(string schooljaarparam) {
var boxes = _db.HelpBoxes.Where(q => q.Schooljaar.Sch_Schooljaar == schooljaarparam);
return View(boxes);
}
and
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.ActionLink("Edit", "Edit", new { id=item.hlpb_ID }) %> |
<%: Html.ActionLink("Details", "Details", new { id=item.hlpb_ID })%> |
<%: Html.ActionLink("Delete", "Delete", new { id=item.hlpb_ID })%>
</td>
<td>
<%: item.hlpb_Titel %>
</td>
<td>
<%: item.hlpb_Schooljaar %>
</td>
<td>
<%: item.hlpb_Ontvanger %>
</td>
<td>
<%: item.SiteMap.Title %>
</td>
</tr>
<% } %>
I get only to see the A, I or D. now I want to show User, Organisation or All
How do I get that value there? I probably need to use an extension but I am not very familiar with Enum's. Some advice would be appreciated.
edit:
it works, but it aint pretty :) I would like to put it in a helper, but how...
<td>
<%: Enum.GetName(typeof(MVC2_NASTEST.Controllers.HelpBoxController.Ontvangers),(int)char.Parse(item.hlpb_Ontvanger.Trim())) %>
</td>