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

RadListBox doesnt show DescriptionText

5 Answers 126 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shaihan
Top achievements
Rank 1
Shaihan asked on 02 Mar 2010, 10:56 AM
i use a radlistbox to display a list of clients. i have set the DataSource, DisplayMember,ValueMember property. during the ItemBound event i set the DescriptionText property for each RadListBoxItem. when the app loads i can only see the DisplayMemebr. the DescriptionText doesn't appear. i have put the RadLisBox inside a RadPanelBar. after i switch to another RadPanelBarGroupElement and come back to the element which shows the client list box, everything is fine. RadPanelBar is set to outlook style.

how can i solve this issue?

5 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 04 Mar 2010, 09:50 AM
Hello Shaihan Murshed,

Thank you for writing. I am afraid that I could not reproduce the behavior you described. 

Please post the code that you are using so that I may assist you further.

Best wishes,

Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shaihan
Top achievements
Rank 1
answered on 04 Mar 2010, 06:26 PM
here is the code for binding data and the event handler

        private void BindNaviagationPanelData() 
        { 
            // bind client listbox datasource 
            lstbxClients.DataSource = GlobalLookup.Clients; 
            lstbxClients.DisplayMember = "FullName"
            lstbxClients.ValueMember = "Id"
            lstbxClients.ItemDataBound += new Telerik.WinControls.UI.ItemDataBoundEventHandler(lstbxClients_ItemDataBound); 
        } // end BindNaviagationPanelData 
 
        void lstbxClients_ItemDataBound(object sender, Telerik.WinControls.UI.ItemDataBoundEventArgs e) 
        { 
            RadListBoxItem item = e.DataBoundItem as RadListBoxItem; 
            UserBasicProfile i = (UserBasicProfile)e.DataItem; 
 
            StringBuilder dsc = new StringBuilder(); 
 
            if (string.IsNullOrEmpty(i.Phone)) 
            { 
                dsc.Append("Phone: \n"); 
            } 
            else 
            { 
                dsc.Append("Phone: ").Append(i.Phone).Append("\n"); 
            } 
 
            if (string.IsNullOrEmpty(i.Email)) 
            { 
                dsc.Append("Email: \n"); 
            } 
            else 
            { 
                dsc.Append("Email: ").Append(i.Email); 
            } 
 
            item.DescriptionText = dsc.ToString(); 
 
            item.DescriptionFont = new Font(item.Font.FontFamily, item.Font.Size, FontStyle.Regular); 
        } // end lstbxClients_ItemDataBound 

i have attached 2 screenshots before and after switching to another group in the navigation panel.

0
Accepted
Victor
Telerik team
answered on 05 Mar 2010, 10:44 AM
Hi Shaihan Murshed,

You must subscribe to ItemDataBound event before you set the data source. The items are created when the data source is set. You simply need to move lstbxClients.ItemDataBound line before the lstbxClients.DataSource line.

Kind regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Shaihan
Top achievements
Rank 1
answered on 05 Mar 2010, 01:53 PM
yup..... that solves my  problem

thanks
0
Victor
Telerik team
answered on 05 Mar 2010, 02:59 PM
Hi Shaihan Murshed,

Write again if you need further assistance.

Sincerely yours,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Shaihan
Top achievements
Rank 1
Answers by
Victor
Telerik team
Shaihan
Top achievements
Rank 1
Share this question
or