RADListBox Bind Description Text

Thread is closed for posting
2 posts, 0 answers
  1. Gourangi
    Gourangi avatar
    83 posts
    Member since:
    Mar 2008

    Posted 17 Feb 2009 Link to this post


    How can I bind a runtime value in description text property of ListBox Item !
    Like there should be databind property (field name) for description text !

    Divyesh Chapaneri
  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 17 Feb 2009 Link to this post

    Hello Divyesh Chapaneri,

    Thank you for the question.

    You can use the ItemDataBound event for your scenario. Although the linked help article is in the RadComboBox section, it is also valid for RadListBox. The code snippet in your case will be similar to the shown below:
    public Form1()  
        this.radListBox1.ItemDataBound += new Telerik.WinControls.UI.ItemDataBoundEventHandler(radListBox1_ItemDataBound);  
        this.radListBox1.DataSource = this.customersBindingSource;  
        this.radListBox1.DisplayMember = "ContactName";  
        this.radListBox1.ValueMember = "CustomerID";  
    private void Form1_Load(object sender, EventArgs e)  
        // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.  
    void radListBox1_ItemDataBound(object sender, Telerik.WinControls.UI.ItemDataBoundEventArgs e)  
        RadListBoxItem item = e.DataBoundItem as RadListBoxItem;  
        item.DescriptionText = ((DataRowView)e.DataItem).Row["ContactTitle"].ToString();  

    If you have additional questions, feel free to contact me.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top