Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8906407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:38:50+00:00 2026-06-15T02:38:50+00:00

I have a strongly typed view where I display consultants with a delete image

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:38:51+00:00Added an answer on June 15, 2026 at 2:38 am

    Yes, it is possible. You can have conditional logic in your template. Here is an example:

    columns.Template(o => 
    {
         if (o.Foo)
         {
           %> 
               <img src="img1.gif" />
           <%
         }
         else
         {
           %>
               <img src="img2.gif" />
           <%
         }
    }).ClientTemplate("<# if (Foo) { #> <img src='img1.gif'/> <# } else { #> <img src='img2.gif' /> <# } #>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strongly typed MVC3 Razor view in which I want to display
i have a strongly typed asp.net-mvc view and the Model has a . Links
I have a strongly typed Person view, that I want to render a partial
I have a strongly typed view and want to use it in an NHaml
I have the following MVC2 view that is strongly typed with a viewmodel, the
I have a strongly typed view in which the first line is; <%@ Page
I have been having multiple problems with getting the Add View.. Create a strongly-typed
I have strongly typed list view I have custom html helper which must get
I have a strongly typed View that accepts a Customer model, this customer model
I have a strongly-typed view with a @model declaration: @model MyViewModel When using extension

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.