SourceDragItems empty when dragging dynamically created items

1 posts, 0 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 14 Jan 2011 Link to this post

    Hi all,

    If I have a static item such as:

    <telerik:RadListBoxItem Text="Test" />

    I see this item in e.SourceDragItems when this function is called:

    protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
        foreach( RadListBoxItem item in e.SourceDragItems)
            RadDock dock = CreateRadDock();
            dock.Tag = item.Text;
            dock.Title = dock.Tag + CurrentDockStates.Count.ToString();

    But, if I add an item to the ListBox at run time:

    protected void LoadHistoricalReports( ReportServicesProxy.HistoricalReport[] historicalReports )
        foreach( var report in historicalReports )
            RadListBoxItem currentItem = new RadListBoxItem(report.Name);

    I see currentItem in my RadListBox, but when I drag the item it says that SourceDragItems is 0. How can I fix this?


    EDIT: It seems if I add to the list box during Page_Init then they show up.
Back to Top