Design and CSS styles
Version 7.x > Design and CSS styles > Transformation Empty View modes: 
User avatar
Member
Member
afique-resolvtech - 11/20/2013 10:16:12 PM
   
Transformation Empty
Hi,

I would like to ask how to make transformation to display my custom table.

<a href="<%# Eval("Pdf1") %>">Pdf1file</a>


My column is Pdf1. But in my custom table, some of the data are not available.

Therefore, I wanted to make 'Pdf1File' will not appear if there are no value in the column.

How can I add IfEmpty in the coding above? Or there is any other way to do this?

Thank you

User avatar
Kentico Consulting
Kentico Consulting
Accepted solutionAccepted solution
Kentico_RichardS - 11/21/2013 1:02:21 AM
   
RE:Transformation Empty
Hello,

Thank you for your message.

You can use IfEmpty function for your purpose. The syntax is following:
IfEmpty(object value, object emptyResult, object nonEmptyResult)
An example can be:
<%# IfEmpty(Eval("ProductPhoto"), "no image", GetImage("ProductPhoto")) %>

You can find all different transformation methods also in this article -> http://localhost/KenticoCMS7_3/CMSHelp/index.html?newedit_transformation_methods.htm

Please let me know how that works.

Kind regards,
Richard Sustek

User avatar
Member
Member
afique-resolvtech - 11/21/2013 3:47:31 AM
   
RE:Transformation Empty
Hi Richard,

Thanks for helping me again..

Now I'm having problem to display my image in custom table.

Referring to this thread:
http://devnet.kentico.com/Forums.aspx?forumid=65&threadid=35497

You help me by suggesting me to use Media Selection

How can I display my image that stored in the custom table?

<td width=20%><%# GetMediaUrl("Pictures") %>

or

<td width=20%><%# GetImagel("Pictures") %>

I tried both of this but it still didn't display

Could you help me to solve this problem?

Thanks

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/21/2013 5:39:38 AM
   
RE:Transformation Empty
Hi,

You are welcome.

Sure, I will be glad to help you with this problem. There are mainly two ways how you can get the image out of the Media selection form control:

1)
<%# GetImageByUrl(Eval("Pictures")) %>


2)
<img src='<%# Eval("Pictures") %>' />


Please let me know how that works.

Kind regards,
Richard Sustek


User avatar
Member
Member
afique-resolvtech - 11/21/2013 5:52:46 AM
   
RE:Transformation Empty
Hi,

Yeah.. As always.. You save me again. It works..Thanks... :)

I just want to understand why did you need to put Eval("Pictures")?

What does Eval stands for? Does it necessary to put if you build a custom table?

Previously I also did <%# GetImageByUrl("Pictures") %> but it only shows the URL instead of the picture.


User avatar
Member
Member
afique-resolvtech - 11/21/2013 6:21:44 AM
   
RE:Transformation Empty
One other thing.. how can I resize the picture?

GetProductImage(Eval("SKUImagePath"), 150, 0, Eval("SKUName"))

For my case, could you help and explain this also to me?

Thanks

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/21/2013 7:27:44 AM
   
RE:Transformation Empty
Hi,

You are welcome, I"m glad I was able to help :-)

The Eval function is used to pull out the data from the database table, it is used mainly for text inputs.

You mean that you want to resize the image from the Media selection form control? This could be possible with:

<%# GetImageByUrl(Eval("Pictures"),100) %> // 100 means the max side size

or:
<%# GetImageByUrl(Eval("Pictures"),100, 100) %> // width x height


However this will only work if you get the image using the GetMedia file -> In other words, this will work if when you are creating a document and selecting the image out of media library you have to save it resized because if you dont the static path to file will be used. But if you do change the size and select the resized image the system will use get media and resize it.

Kind regards,
Richard Sustek

User avatar
Member
Member
afique-resolvtech - 11/21/2013 9:05:47 PM
   
RE:Transformation Empty
Thanks again Richard.

On resizing, I still cannot resize the picture using this,

<%# GetImageByUrl(Eval("Pictures"),100, 100) %>

I don't why. However, when I use this,

<img src='<%# Eval("Gambar") %>' width=85 height=127 />

I managed to control the size.

Just to confirm, would it be any problem if I continue using the second method?

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/22/2013 1:52:31 AM
   
RE:Transformation Empty
Hi,

You're welcome.

There wouldnt be any issue, I would even say that it is more convinient to use the second way because you have more control of how your images get rendered.

Let me know if you have further questions.

Kind regards,
Richard Sustek

User avatar
Member
Member
afique-resolvtech - 11/22/2013 2:07:21 AM
   
RE:Transformation Empty
Ok,Sure. I will definitely post in the forum if I have any further questions.

Thanks :)