I normally use a grid along with a gridbinaryimagecolumn to display images from the database in my grid.
How do I go about doing the same thing in a RadTreeList? I've tried with a template column and a radbinaryimage but can't get a way of storing the database driven image into a hidden column.
Any suggestions?
Regards
Jon
How do I go about doing the same thing in a RadTreeList? I've tried with a template column and a radbinaryimage but can't get a way of storing the database driven image into a hidden column.
Any suggestions?
Regards
Jon
4 Answers, 1 is accepted
0
Hello Jon,
Since RadTreeList does not have BinaryImageColumn, what you could do is to use TreeListTemplateColumn and place RadBinaryImage control in the ItemTemplate. Following is a simple example demonstrating such approach, where the BinaryImage field is of byte[] type:
Hope this helps.
Regards,
Konstantin Dikov
Telerik
Since RadTreeList does not have BinaryImageColumn, what you could do is to use TreeListTemplateColumn and place RadBinaryImage control in the ItemTemplate. Following is a simple example demonstrating such approach, where the BinaryImage field is of byte[] type:
<telerik:RadTreeList runat="server" ID="RadTreeList1" DataKeyNames="ID" ParentDataKeyNames="ParentID" OnNeedDataSource="RadTreeList1_NeedDataSource" AutoGenerateColumns="false"> <Columns> <telerik:TreeListBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID"> </telerik:TreeListBoundColumn> <telerik:TreeListTemplateColumn> <ItemTemplate> <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("BinaryImage") %>' /> </ItemTemplate> </telerik:TreeListTemplateColumn> </Columns></telerik:RadTreeList>Hope this helps.
Regards,
Konstantin Dikov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Jon
Top achievements
Rank 1
answered on 23 Jun 2014, 03:16 PM
Hi Konstantin,
Ah yes - I missed that one - I'll put it down to the bad cold that I had last week!
What is the best approach for handling a Null field value in this instance?
Regards
Jon
Ah yes - I missed that one - I'll put it down to the bad cold that I had last week!
What is the best approach for handling a Null field value in this instance?
Regards
Jon
0
Accepted
Hello Jon,
For handling null values you could use the following approach:
However, since the above will still try to display an image, I could suggest an approach where you add a default image (like NoImage template) or set the control visibility to false if the value is null:
Hope this helps.
Regards,
Konstantin Dikov
Telerik
For handling null values you could use the following approach:
<telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%# Eval("BinaryImage") is DBNull ? new byte[0] : Eval("BinaryImage") %>' />However, since the above will still try to display an image, I could suggest an approach where you add a default image (like NoImage template) or set the control visibility to false if the value is null:
<telerik:RadBinaryImage runat="server" Visible='<%# !(Eval("BinaryImage") is DBNull) %>' ID="RadBinaryImage1" DataValue='<%# Eval("BinaryImage") is DBNull ? new byte[0] : Eval("BinaryImage") %>' />Hope this helps.
Regards,
Konstantin Dikov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Jon
Top achievements
Rank 1
answered on 26 Jun 2014, 11:58 AM
Hi Konstantin,
Of course, obvious now! Thanks for that.
The page looks superb now - a very useful addition :)
Best Regards
Jon
Of course, obvious now! Thanks for that.
The page looks superb now - a very useful addition :)
Best Regards
Jon
