RadComboBoxItem Attributes

3 posts, 1 answers
  1. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 15 Feb 2011 Link to this post

    Hi:

    I have  a RadComboBox that is using an ItemTemplate.
    <telerik:RadComboBoxItem Value="0" Text="Report 1" ReportName="Report 1" About="Select product(s) and view details" Dir="/Invent/" Prompts="False"></telerik:RadComboBoxItem>

    I was hoping to use this as a repository per my reports.  Is there a way to get to the various attributes.

    Phil
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2011 Link to this post

    Hello,


    You could use the "Custom Attributes" for RadComboBoxItem to expand the information stored with the items.
    Custom Attributes
    ItemDataBound


    -Shinu.
  3. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 16 Feb 2011 Link to this post

    Thanks...
    So:
    protected void  cboReport_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        int _idx = cboReport.SelectedIndex;
        RadComboBoxItem _ri = cboReport.Items.Item(_idx);
        string _reportName = _ri.Attributes("ReportName");
        string _about = _ri.Attributes("About");
    }
    or ..
    Protected Sub cboReport_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cboReport.SelectedIndexChanged
        Dim _idx As Integer = cboReport.SelectedIndex
        Dim _ri As RadComboBoxItem = cboReport.Items.Item(_idx)
        Dim _reportName As String = _ri.Attributes("ReportName")
        Dim _about As String = _ri.Attributes("About")
    End Sub
Back to Top