View Full Version : Adding image to list

18 Oct 2010, 8:54 PM

I am wondering how to add an image to the tpl of the list control? I would like to add an image to the template of databound list. For example,

tpl: '<tpl for="."><div class="menu listproperty"><strong>{PropertyName}</strong><div><string style="display:none"">{PropertyID}</strong></div></div></tpl>'

many thanks

18 Oct 2010, 9:13 PM
It accepts arbitrary html, so just dump an image tag in there.

18 Oct 2010, 9:25 PM
OK thanks.

18 Oct 2010, 9:30 PM
Just one more thing pls. Can I put "if else statements" in the tpl since the image/url is dynamic and can be changed based on a particular id?

18 Oct 2010, 9:43 PM
Yep, all of that is covered in the XTemplate docs. Expand the constructor.

18 Oct 2010, 9:51 PM
Ok thank you. I found it.

10 Jul 2011, 3:54 PM
I am able to add an icon with a hyperlink in a nested list element. But when I click on the icon, instead of following the link, I get the default behavior of the nestedlist, which is to show me the next level. Anyway, I can override this default behavior and have it show me the page that the link points to?

Thanks in advance,