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

Image in ComboBox in Grid?

3 Answers 95 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 17 Feb 2008, 11:34 PM
I have a ComboBox defined in a grid column as follows:

<telerik:GridTemplateColumn UniqueName="den_type_id" HeaderText="Den Type">  
    <ItemStyle Width="175" /> 
    <ItemTemplate> 
        <asp:Label Width="170" CssClass="gridDropDownLabel" runat="server" ID="lbl_den_type_id" Text='<%#DataBinder.Eval(Container.DataItem, "den_type_nm")%>' /> 
    </ItemTemplate> 
    <EditItemTemplate> 
        <telerik:RadComboBox Width="170" MarkFirstMatch="true" Skin="scSkin" EnableEmbeddedSkins="false" DataTextField="den_type_nm" DataValueField="den_type_id" DataSourceID="DenTypeDataSource" ID="dd_den_type_id" runat="server" SelectedValue='<%#Bind("den_type_id") %>' Text="Select a Type" /> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 

I also have a function in the code behind that adds a row

    Private Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
        If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then  
            Dim item As GridEditableItem = e.Item  
            Dim combo As RadComboBox = item.FindControl("dd_den_ldr_id")  
 
            combo.Items.Insert(0, New RadComboBoxItem("Select a Den Leader", "0"))  
        End If  
    End Sub 

Is there a way to add an image to each item so that there's text + image? In the demos, they use ImagePath, but I can't figure out if this property is available when using the combobox in a grid column. Thanks.

3 Answers, 1 is accepted

Sort by
0
Philip
Top achievements
Rank 1
answered on 17 Feb 2008, 11:44 PM
hmmm...I was actually able to do it with an ItemTemplate for the ComboBox :)

Didn't think that would work, but it did. I did lose my mouse over styling, so I'll have to add that back in manually. Pretty cool :)
0
Duc
Top achievements
Rank 1
answered on 08 Jan 2009, 08:29 PM
I have images and text appearing in my combobox items as well using <ItemTemplate>. Is there a way after I select an item that the selected item has an image and text as well? At the moment when I select an item I only see text appearing as defined by the DataTextField property.

Thanks
Duc
0
Veselin Vasilev
Telerik team
answered on 09 Jan 2009, 08:28 AM
Hello Duc,

I am afraid this is not possible.

All the best,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Philip
Top achievements
Rank 1
Answers by
Philip
Top achievements
Rank 1
Duc
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or