Hi,
I'm programming web site to use the grid with MVC...
I have this example in your web Site
https://www.igniteui.com/templating-engine/conditional-templates
I want to use the conditional-Templates to change the color of a specifi cell for the specific value.
I want to know where i can find some MVC example or tell me how i can convert this to MVC.
thx
Hello Michel,
Thank you for contacting Infragistics!
To achieve conditional templates in MVC instead of using a script tag you can just pass in your template as a string, for example:
column.Unbound("Person").HeaderText("Template").Template(“{{if ${age} > 21 }} <tr><td><b>First Name: </b>${firstName}</td><td><b>Last Name: </b>${lastName}</td><td><b>Age: </b>${age}</td></tr> {{/if}}”);
https://www.igniteui.com/help/creating-basic-conditional-template#steps
https://www.igniteui.com/help/creating-conditional-template-containing-default-statement
What wrong in the template of the EventDate Column the cell is always empty
@(Html.Infragistics() .Grid(Model.CleaningTasks) .ID("grid1") .Height("500px") .AutoGenerateColumns(false) .AutoGenerateLayouts(false) .Columns(column => { //column.For(x => x.RecordID).HeaderText("#enregistrement"); column.Unbound("EventDateMonth").HeaderText("Mois").Formula("getEventDateMonth").Format("MMM-yy"); column.For(x => x.HouseNo).HeaderText("Bâtiment d'élevage").Template("<b>${HouseNo}</b>"); column.For(x => x.EventDate).HeaderText("Date d'entrée").Template("{{if ${EventDate} < new Date()}}" + "<div style='background-color:yellow'>${EventDate}</div>" + "{{elseif ${EventDate} > new Date()}}" + "<div style='background-color:green'>${EventDate}</div" + "{{/if}}" ); column.For(x => x.LastModificationDate).HeaderText("Dernière modif.").Format("ddd, dd MMM yy HH:mm").FormatterFunction("formatColumn"); }) .Features(features => { features.Sorting().Type(OpType.Local); features.CellMerging().InitialState(CellMergingInitialState.Merged); //features.Paging().Type(OpType.Local); //features.Filtering().Type(OpType.Local); }) .DataSource((from rec in Model.CleaningTasks where rec.DetailsType == DetailsTypeEnum.Placed select rec).AsQueryable()) .DataBind() .Render() )