I have a strongly typed view where I display consultants with a delete image in one of the columns in a telerik grid. I have a column "Status" where I store if a consultant is active or inactive. What I want to do is, If a consultant has an "Active" status then display a grayed delete image(disabled, cant delete a consultant as he/she is active), else display a red delete image(enabled, can delete a consultant as he/she is inactive). Is this possible with my design below?
Controller Action:
public ActionResult Index()
{
ViewData.Model = db.Consultants.OrderBy(p => p.ConsultantName);
return View();
}
View:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<UI.Models.Consultants>>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table>
<tr>
<td><% Html.GridFor("Consultants", "Consultants", "Consultants", GridOptions.EnableSelecting, Model).Columns(column =>
{
column.Bound(o => o.Code).Title("Code");
column.Bound(o => o.Description).Title("Description");
column.Template(o =>
{
%>
<img src="/Content/img/delete.png" alt="consultant" title="consultant" onclick="javascript:deleteConsultant(<%= o.consultantKey %>)" />
<%
}).Title("").ClientTemplate(
"<img src=\"/Content/img/delete.png\" alt=\"consultant\" title=\"consultant\" onclick=\"javascript:deleteConsultant(<#= ProjectKey #>)\"/>");
column.Bound(o => o.consultantKey).Hidden();
}).Render();
%>
</td>
</tr>
</table>
</asp:Content>
Any help is much appreciated.