Insert variable image and text in Grid


Hi, I saw the example in https://www.syncfusion.com/products/aspnetcore/data-grid and I wanted to understand if with <ej: Grid and <ej: Column with data coming from a datatable if I can add a arrow image and text based on the result. Thanks in advance.

3 Replies

KM Kuralarasan Muthusamy Syncfusion Team May 23, 2018 12:01 PM UTC

Hi Scarpello, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we found that you want add the images in column based on the result in grid. So we suggest you to template property of the grid columns to achieve your requirement. 

Please refer the following code example: 

<ej-grid id="Grid" datasource=ViewBag.parent allow-paging="true"  > 
 
                ..... 
 
    <e-columns> 
        <e-column header-text="Images" template="#columnTemplate"></e-column> 
    </e-columns> 
</ej-grid> 
 
<script type="text/x-jsrender" id="columnTemplate"> 
    {{if EmployeeID < 5}} 
    <img src="/css/ej/web/bootstrap-theme/images/checkedtick.png"/> 
    {{else}} 
    <img src="/css/ej/web/bootstrap-theme/images/waitingpopup.gif"/> 
   {{/if}} 
</script> 

In this code we have used template column. Before render the template we have checked the condition based on the EmployeeID value. If EmployeeID value is less than 5 then its render one image, otherwise render another one image. Also we have prepared the sample with your requirement and that sample can be downloadable from the below link, 


Please refer the following link to know about column template: 


If you need further assistance please get back to us, 

Regards, 
Kuralarasan M. 
  



CS Carmelo Scarpello May 25, 2018 02:33 PM UTC


thank you


KM Kuralarasan Muthusamy Syncfusion Team May 28, 2018 05:50 AM UTC

Hi Scarpello, 
 
Please get back to us if you require further assistance on this. 
 
Regards, 
Kuralarasan M. 


Loader.
Up arrow icon