I'm doing maintenance on MVC for an employees table. I have made a grid that shows the list of employees, and I added buttons to edit and delete in each record, but I want to say delete instead say "Give High" or "Unsubscribe" depending on the field state of the table employees . This is the code of the view:
@model IEnumerable<AppProfileDAL.v_employee>
@using GridMvc.Html
@{
ViewBag.Title = "Index";
}
<div class="right-side">
<h2>Index</h2>
<p>
@*@Html.ActionLink("Create New", "Create")*@
<a href="@Url.Action("Create", "v_employee")" class="btn btn-primary active">
<span class="glyphicon glyphicon-plus"></span> Nuevo
</a>
</p>
@Html.Grid(Model).Columns(
columns =>
{
columns.Add(c => c.nombres).Titled("Name");
columns.Add(c => c.apellidos).Titled("Last Name");
columns.Add().Sanitized(false).Encoded(false).RenderValueAs(o => Html.ActionLink("Editar", "Edit", "v_employee", new { Id = o.user_id}, null).ToHtmlString());
if () { //Aquí esta el problema
columns.Add().Sanitized(false).Encoded(false).RenderValueAs(o => Html.ActionLink("Down", "Delete", "v_employee", new { Id = o.user_id}, null).ToHtmlString());
}
else
{
columns.Add().Sanitized(false).Encoded(false).RenderValueAs(o => Html.ActionLink("Up", "Delete", "v_employee", new { Id = o.user_id}, null).ToHtmlString());
}
columns.Add().Sanitized(false).Encoded(false).RenderValueAs(o => Html.ActionLink("Imprimir", "Print", "v_employee", new { Id = o.user_id}, null).ToHtmlString());
}).WithPaging(10).Sortable(true)
Do you know any way to read the state field of the table and put it in the conditional of the if?
Thank you!