Error loading long list

4 posts, 0 answers
  1. Washington
    Washington avatar
    14 posts
    Member since:
    Oct 2013

    Posted 27 Jan 2015 Link to this post

    I'm using RadExpanderControl within the RadDataBoundListBox.

    My list has 30 items. Each item has a maximum of 30 sub-items.

    When I scroll the RadDataBoundListBox an error is generated, but if I do not load the sub-items, everything works perfectly.

    Could you could provide an example loading a list with a lot items and sub-items?

    Thanks!
  2. Washington
    Washington avatar
    14 posts
    Member since:
    Oct 2013

    Posted 29 Jan 2015 Link to this post

    You can reproduce the error changing the code provided in the Sample to this:

    Page: Examples_WP/ExpanderControl/Inbox.xaml.cs

    private List<EmailMessage> PrepareData()
    {
       List<EmailMessage> result = new List<EmailMessage>();
       for (int i = 0; i < 40; i++)
       {
           EmailMessage m = new EmailMessage();
           m.Date = new DateTime(2012, 8, 7);
           m.Sender = "Telerik " + i;
           m.Subject = "Thanks for purchasing RadControls for Windows Phone";
           m.Content = "Dear Customer, Thanks for purchasing RadControls for Windows Phone!";
           result.Add(m);
     
           m = new EmailMessage();
           m.Date = new DateTime(2012, 8, 10);
           m.Sender = "Me " + i;
           m.Subject = "RadExpanderControl Support";
           m.Content = "Dear Support, I would like to know how to customize the animation of the control?";
           result.Add(m);
     
           for (int x = 0; x < new Random().Next(3, 15); x++)
           {
              EmailMessage m1 = new EmailMessage();
              m1.Date = new DateTime(2012, 8, 11);
              m1.Sender = "Me " + x;
              m1.Subject = "RadExpanderControl Support";
              m1.Content = "Thanks for your support! Another question: how to set the IsExpanded property via Visual States?";
              m.Conversation.Add(m1);
     
              m1 = new EmailMessage();
              m1.Date = new DateTime(2012, 8, 10);
              m1.Sender = "Telerik " + x;
              m1.Subject = "RadExpanderControl Support";
              m1.Content = "Customizing RadExpanderControl can be done in a couple of various ways.";
              m.Conversation.Add(m1);
           }               
       }
       return result;
    }

    I hope this can help to find the issue.

    tnks
  3. DevCraft banner
  4. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    550 posts

    Posted 30 Jan 2015 Link to this post

    Hi Washington,

    Thank you for contacting us.

    The problem is that you first create an EmailMessage and add it to the result collection; then you modify the same message object and add it again to the collection. Thus you have the same message added twice to the collection and this causes the error in the RadDataBoundListBox. I have attached a sample project that demonstrates how you can get your scenario to work.

    I hope this helps.

    Regards,
    Rosy Topchiyska
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Washington
    Washington avatar
    14 posts
    Member since:
    Oct 2013

    Posted 30 Jan 2015 in reply to Rosy Topchiyska Link to this post

    Awesome! Tnks...
Back to Top
DevCraft banner