Search code examples
c#asp.netcssstylesradcombobox

How to format the RadComboBox properly


I am trying to make an arrow show to the left of the text, but I cant figure out how to format it to make it work.

And my mark up for the rad box is as follows:

<telerik:RadComboBox ID="optionsp" runat="server" HighlightTemplatedItem="true">
     <ItemTemplate>
          <img src="../../../Themes/Images/icons/myimage.gif" />
             <div style="text-align: left; padding-left: 5px"> 
                <asp:Label runat="server" ID="Label1" Text='<%# Eval("Name") %>' > 
                </asp:Label> 
              </div> 
     </ItemTemplate>
  </telerik:RadComboBox>

Solution

  • Try with this (added float: left for img and div.

    <telerik:RadComboBox ID="optionsp" runat="server" HighlightTemplatedItem="true">
         <ItemTemplate>
              <img src="../../../Themes/Images/icons/arrow2.gif" style="float: left" />
              <div style="text-align: left; padding-left: 5px; float: left"> 
                    <asp:Label runat="server" ID="Label1" Text='<%# Eval("Name") %>' > 
                    </asp:Label> 
              </div> 
         </ItemTemplate>
    </telerik:RadComboBox>
    

    As a side note, avoid inline style definitions as much as possible, you should move them to a css file.