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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Template in Grid with img

Thread ID:

Created:

Updated:

Platform:

Replies:

116545 Jun 9,2014 12:28 AM Jun 13,2014 01:32 AM ASP.NET MVC 5
loading
Tags: Grid
Jesus Sanchez
Asked On June 9, 2014 12:28 AM

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.



Ragavee U S [Syncfusion]
Replied On June 10, 2014 06:08 AM

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

Jesus Sanchez
Replied On June 12, 2014 11:57 AM


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

Can you help me??


Jesus Sanchez
Replied On June 12, 2014 12:01 PM

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' ¿?


Jesus Sanchez
Replied On June 12, 2014 01:23 PM

Solved!!!


{{if EmployeeID != null}}

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

{{/if}}

Thanks!!


Ragavee U S [Syncfusion]
Replied On June 13, 2014 01:32 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;