We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Template in Grid with img

Hi,

I have a Grid control with one column and within one template with image:

<script type="text/x-jsrender" id="columnTemplate">

    <img style="width: 75px; height: 70px" alt="{{:Name}}" src="data:image/gif;base64,{{:SPhoto}}" />

</script>

If {{:SPoto}} == null, in the cell of the Grid shows:

I want to see this empty column: nothing, without image .... how can i make it???, can you help me??

Thanks.



5 Replies

RU Ragavee U S Syncfusion Team June 10, 2014 10:08 AM UTC

Hi Jesus

 

We have analyzed your requirement to display empty column when SPoto is null. It can be achieved using an if condition within the columnTemplate.

 

Please refer the below code snippet:

 

<script type="text/x-jsrender" id="columnTemplate">

    @if("{{:SPoto}}" != null){

    <img style="width: 75px; height: 70px" src=" data:image/gif;base64, {{: SPoto }}.png" alt="{{: SPoto }}" />

    }

</script>

 

For your convenience, we have created a simple sample based on your requirement and the same can be downloaded from the attachment.

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S



Attachment: Sample_6471e784.zip


JS Jesus Sanchez June 12, 2014 03:57 PM UTC


We follow the same... does not work?
I don't want to out anything when you have not and image

Can you help me??



JS Jesus Sanchez replied to Ragavee U S June 12, 2014 04:01 PM UTC

Hi Jesus

 

We have analyzed your requirement to display empty column when SPoto is null. It can be achieved using an if condition within the columnTemplate.

 

Please refer the below code snippet:

 

<script type="text/x-jsrender" id="columnTemplate">

    @if("{{:SPoto}}" != null){

    <img style="width: 75px; height: 70px" src=" data:image/gif;base64, {{: SPoto }}.png" alt="{{: SPoto }}" />

    }

</script>

 

For your convenience, we have created a simple sample based on your requirement and the same can be downloaded from the attachment.

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S



Attachment: Sample_6471e784.zip

'Expression is always true' ¿?



JS Jesus Sanchez June 12, 2014 05:23 PM UTC

Solved!!!


{{if EmployeeID != null}}

<img style="width: 75px; height: 70px" src="/Employees/{{:EmployeeID}}.png" alt="{{:EmployeeID}}" />

{{/if}}

Thanks!!



RU Ragavee U S Syncfusion Team June 13, 2014 05:32 AM UTC

Hi Jesus.

 

Thanks for the update.

 

If you have any issues in the future, please get back to us we will be happy to assist you.

 

Please let us know if you would require any further assistance.

 

Regards

Ragavee U S


Loader.
Live Chat Icon For mobile
Up arrow icon