This is a migrated thread and some comments may be shown as answers.

Icon for Items - SQLDatasource for List

2 Answers 81 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Heath Brown
Top achievements
Rank 1
Heath Brown asked on 14 Oct 2009, 04:34 PM
Hello,

I'm using an SQL Datasource for my list.  It receives the value, text, and sort order from the SQLDataSource.  I would like to put an icon to the left of each list item (it will be the same icon each time - it isn't different on each item).  Almost like a bullet point icon.  I'm just doing this to dress up my list a little bit.  Can someone give me an example of how to do this with an SQLDataSource?  Here is an example of my ListBox:

<telerik:RadListBox ID="RadListBox1" runat="server"   
                                        DataKeyField="TopicAssign_ID" DataSourceID="SqlDataSource1"   
                                        DataTextField="TopicName"   
                  DataValueField="TopicAssign_ID" Skin="Office2007"   
                                        Width="100%" AllowAutomaticUpdates="True"   
                  AllowReorder="True" AutoPostBackOnReorder="True" DataSortField="SortOrder"   
                  EmptyMessage="The curently selected Role has no Topics"   
                  onreordered="RadListBox1_Reordered" TransferMode="Copy"   
                  EnableDragAndDrop="True" Height="300px" style="top: 0px; left: 0px">  
                                    <EmptyMessageTemplate> 
                                        The curently selected Role has no Topics  
                                    </EmptyMessageTemplate> 
                                    </telerik:RadListBox> 

I have an image named TopicListItems.png and will use that image for each item on the list.

Any help appreciated!

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 15 Oct 2009, 02:29 PM
Hello Heath Brown,

You should use the ItemDataBound event of RadComboBox. There you could set the ImageUrl property of the databound combobox item:

e.Item.ImageUrl = "TopicListItems.png";

Regards,
Albert,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Heath Brown
Top achievements
Rank 1
answered on 15 Oct 2009, 02:48 PM
Worked like a charm!  Thanks again.
Tags
ListBox
Asked by
Heath Brown
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Heath Brown
Top achievements
Rank 1
Share this question
or