Hey Kevin,
I have found out what the issue was: None of the RadComboBox examples actually show how to pull an image from the database along with the text.
I was following the
First Look example and tried to use its implementation to create a templated combobox to use its
LoadOnDemand feature to fetch the names and pictures of employees from a database. As it turns out, I didn't need to follow this example at all. In fact, none of the examples for the RadComboBox shows how to do this. They all make reference to a physical file of some sort, or reference to a file location stored in the database as text, or a CSS that does that.
My RadComboBox is inside a TemplateColumn of a RadGrid. All I wanted was that when the user clicks on the drop down list, they see a list of employees, by picture and name. That's all. The first look example made it appear as though using LoadOnDemand was the only way to get that done. (Maybe it's too complex for a first look example).
All I did was to point my templated RadComboBox to the ObjectDataSource that pulls the data from the database, then use a simple Eval("FieldName") in the ItemTemplate of the RadComboBox to show all the fields I required. For the picture, I used a RadBinaryImage on the ItemTemplate and bound its
DataValue property to the Picture field using Eval("Picture") as you suggested and that was it.
I didn't need to write any additional code to do read the image from the database or use a HttpHandler to serve up the image for each row. In fact, for anyone else who may be struggling with this, my entire TemplateColumn implementation is thus:
It's that simple - and this works beautifully. I hope this will help someone else who is just looking for a simple way to show both text and images pulled from the database without having to write any code behind.
May I suggest that a simple example be put on the RadComboBox demos page for this? It would clear up a lot of the questions I see asked about this feature in this forum. Most users new to the intricacies of the control aren't looking for anything too complicated.
Thanks for all your attention.
Regards,
Jonathan