Is it possible to use extended radcomboboxitem for databound combobox

2 posts, 0 answers
  1. Dustin
    Dustin avatar
    7 posts
    Member since:
    Aug 2010

    Posted 07 Feb 2011 Link to this post

    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
                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
  2. Daniel
    Daniel avatar
    5 posts
    Member since:
    Jun 2012

    Posted 13 Jul 2012 Link to this post

    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 ajax, but in c# this would be as simple as:
    protected override DependencyObject GetContainerForItemOverride()
        return new FeatureBoxItem();
Back to Top