TreeList.SelectedItems showing only current page selected items in telerik

111 Views Asked by At

I am using Telerik Radtreelist controls here is the markup

<telerik:RadTreeList ID="rtreeList_Topic" runat="server" OnNeedDataSource="rtreeList_Topic_NeedDataSource"
                             ParentDataKeyNames="parent_topicid" DataKeyNames="topicid" AllowPaging="true" RenderMode="Classic" Skin="WebBlue"
                             AutoGenerateColumns="false" AllowSorting="true" 
                             OnDeleteCommand="rtreeList_Topic_OnDeleteCommand" OnInsertCommand="rtreeList_Topic_OnInsertCommand" 
                            OnUpdateCommand="rtreeList_Topic_OnUpdateCommand"  AllowMultiItemSelection="True"
                             OnItemDataBound="rtreeList_Topic_OnItemDataBound" HeaderStyle-Height="35px">

            <Columns>
                <telerik:TreeListSelectColumn HeaderStyle-Width="25px">
                </telerik:TreeListSelectColumn>
                <telerik:TreeListTemplateColumn HeaderText="Topic ID" HeaderStyle-Width="40px">
                    <ItemTemplate>
                        <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("topicid") %>'></asp:HyperLink>
                    </ItemTemplate>
                </telerik:TreeListTemplateColumn>
                <telerik:TreeListBoundColumn DataField="parent_topicid" UniqueName="parent_topicid" HeaderText="Parent Topic Id" Visible="False">
                </telerik:TreeListBoundColumn>

Here, you can see I have a TreeListSelectColumn and after selection I want to get each selected TreeListDataItem..

for obvious reason I could do iterate over Radtreelistselected item

foreach(var item in rtreeList_Topic.SelectedItems) 
{
    var dr = dtselected.NewRow();
    dr["parent_topic_id"] = item["parent_topicid"].Text.Contains("&nbsp;") ? DBNull.Value : (object) Convert.ToInt32(item["parent_topicid"].Text);
    dr["subject_code"] = rcb_subject_code.SelectedItem.Text;
    dr["topic_id"] = Convert.ToInt32(item["topicid"].Text);
    dr["topic_description"] = item["topicname"].Text;
    dr["topic_shortname"] = item["ShortName"].Text;
    dtselected.Rows.Add(dr);
}

Now say on First page(in footer you can have pages) have selected 4 items and on second page I have selected 2 items. so rtreeList_Topic.SelectedItems.Count = 6 ? but no it showing only second page's selected item.. why? If there is any problem in my code please let me know.. Thanks :)

0

There are 0 best solutions below