Icon for Items - SQLDatasource for List

3 posts, 1 answers
  1. Heath Brown
    Heath Brown avatar
    32 posts
    Member since:
    Oct 2009

    Posted 14 Oct 2009 Link to this post

    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. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 15 Oct 2009 Link to this post

    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.
  3. Heath Brown
    Heath Brown avatar
    32 posts
    Member since:
    Oct 2009

    Posted 15 Oct 2009 Link to this post

    Worked like a charm!  Thanks again.
Back to Top