views:

174

answers:

1

HI,

I am using the MVCContrib grid and I would like to display images depending on the values of a column, e.g.:

  • if the column's value is null display the image "<img src="true.gif">"
  • otherwise display the image "<img src="false.gif">

Furthermore I would also need (this should be the same approeach I think) to display different actions depending on the column's/rows' value ...

Thanks in advance for your answers!

Best regards
Stefan

+2  A: 

The answer was quite simple :)

<% Html.Grid(Model.Languages).Columns(column =>
       {
           column.For(c => c.LanguageName).Named("Language");
           column.For(c => c.LangCode).Named("Language Code");
           column.For(c => c.IsDefaultLanguage.Equals(true) ? "<img src=\"library/images/true.gif\">" : "<img src=\"library/images/false.gif\">").Named("Default Language").DoNotEncode();
       }

       ).Empty("There are no language available")
        .Render(); %>
Ghecco
+1 ... (Please accept your answer)
Rashmi Pandit