RadListBox doesnt show DescriptionText

6 posts, 1 answers
  1. Shaihan
    Shaihan avatar
    12 posts
    Member since:
    Jan 2010

    Posted 02 Mar 2010 Link to this post

    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?
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 04 Mar 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Shaihan
    Shaihan avatar
    12 posts
    Member since:
    Jan 2010

    Posted 04 Mar 2010 Link to this post

    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.

  5. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Mar 2010 Link to this post

    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.
  6. Shaihan
    Shaihan avatar
    12 posts
    Member since:
    Jan 2010

    Posted 05 Mar 2010 Link to this post

    yup..... that solves my  problem

    thanks
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Mar 2010 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready