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

Is it possible to use extended radcomboboxitem for databound combobox

1 Answer 30 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dustin
Top achievements
Rank 1
Dustin asked on 07 Feb 2011, 09:34 PM
I have an extended radcombobox item call FeatureComboBoxItem that adds a featureID to the radcomboboxitem.  I'd like to have these types of objects used instead of the normal radcombobox item when automatically databinding from a sqldatasource control.  To support this I extended the radcombobox to include a string property that tells the name of the column used to populate the featureID of the FeatureComboBoxItem.  I figured there was a function I could overwrite to return FeatureComboBoxItems instead of the normal radcomboboxitem but I got lost.  Is it possible to use a different type of object for the item or am I stuck with using a radcomboboxitem?

Public Class FeatureBoxItem
    Inherits Telerik.Web.UI.RadComboBoxItem
    Implements IFeatureItem

    Public Property FeatureID As System.Guid Implements IFeatureItem.ID
        Get
            Return If(ViewState("FeatureID"), Guid.Empty)
        End Get
        Set(ByVal value As System.Guid)
            ViewState("FeatureID") = value
        End Set
    End Property


    'IFeatureItem implementation hidden


    End Sub
End Class

Public Class FeatureComboBox
Inherits Telerik.Web.UI.RadComboBox

'What do I do in here?
End Class

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 13 Jul 2012, 04:16 PM
Not trying to res this thread. I just thought I'd give an answer because I was trying to do the same thing and spent several hours searching (this was the second result in google, and it had no answer)

In the RadComboBox, override the method "GetContainerForItemOverride()" and return an instance of your custom RadComboBoxItem

I don't know asp.net ajax, but in c# this would be as simple as:
protected override DependencyObject GetContainerForItemOverride()
{
    return new FeatureBoxItem();
}
Tags
ComboBox
Asked by
Dustin
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or