Advanced binding with Datapager Problem

2 posts, 0 answers
  1. Ayberk
    Ayberk avatar
    4 posts
    Member since:
    Jul 2010

    Posted 04 Jul 2011 Link to this post

    I am using Advanced databinding method. When yapAfter button is clicked I add an item to my List stored in the session according to the specific index and I rebind my List. Also in NeedData Source event my List stored in the session is binded. There is no problem when Allowpaging is off in Listview. However when I turn on Allowpaging the items I added last to my List comes out at the beginning of the List. They are not listed according to the Index I assigned while adding.  


    <telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ProductsHolder"
                OnNeedDataSource="RadListView1_NeedDataSource" OnItemDataBound="RadListView1_ItemDataBound"
                OnItemCommand="RadListView1_ItemCommand" DataKeyNames="RID">
                    <asp:Panel ID="ProductsHolder" runat="server" />
                    <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
                        PageSize="50" AllowSEOPaging="False" AllowRouting="False">
                            <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                            <telerik:RadDataPagerButtonField FieldType="Numeric" />
                            <telerik:RadDataPagerButtonField FieldType="NextLast" />
                            <telerik:RadDataPagerPageSizeField PageSizeText="Page size: " />
                            <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
                                TextBoxWidth="15" />
                                    <div style="float: right">
                                            <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" />
                                            <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
                                            <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                                            <br />
                    <div id="segment<%#Eval("RID") %>" class="segment">
                                <td style="width: 50px">
                                    <telerik:RadButton ID="RadButton1" runat="server" Text="X" CommandName="deleteSegment">
                                    <input name="Button11" type="button" onclick="javascript:deleteSegment('#segment<%#Eval("RID") %>');"
                                        value="X" />
                                <td style="width: 100%">
                                    <textarea id="sourceTextarea" name="sourceTextarea" style="width: 98%"><%#Eval("Segment") %></textarea>
                                    <telerik:RadButton ID="RadButton2" runat="server" Text="+" CommandName="yapAfter">
                                    <input name="Button11" type="button" onclick="javascript:yapAfter_source('#segment<%#Eval("RID") %>');"
                                        value="+" />
                                    <input name="Button11" type="button" onclick="javascript:splitSegment('#segment<%#Eval("RID") %>');"
                                        value="-/-" />
                                    <input name="Button11" type="button" onclick="javascript:segmentMerge('#segment<%#Eval("RID") %>');"
                                        value=">|<" />

    protected void RadListView1_NeedDataSource(object sender, Telerik.Web.UI.RadListViewNeedDataSourceEventArgs e)
            if (!IsPostBack)
                if (String.IsNullOrEmpty(HiddenField1.Value))
                decimal m_ProjectRef = Convert.ToDecimal(HiddenField1.Value);
                List<prepdata> mList = new List<prepdata>();
                mList = PreprocessHelperDB.getDataSource(m_ProjectRef);
                Session["myList"] = mList;
                RadListView1.DataSource = mList;
                List<prepdata> mList = (List<prepdata>)Session["myList"];
                RadListView1.DataSource = mList;
    protected void RadListView1_ItemCommand(object sender, RadListViewCommandEventArgs e)
    if (String.Equals(e.CommandName, "yapAfter"))
                decimal m_ProjectRef = Convert.ToDecimal(HiddenField1.Value);
                RadListViewDataItem dataItem = (RadListViewDataItem)e.ListViewItem;
                List<prepdata> mList = new List<prepdata>();
                mList = (List<prepdata>)Session["myList"];
                mList.Insert(0, new prepdata { Segment = "asdsadaAA index:" + 0});
                mList.Insert(1, new prepdata { Segment = "asdsadaAA:" + 1 });
                mList.Insert(5, new prepdata { Segment = "asdsadaAA:" + 5 });
                Session["myList"] = mList;

  2. Pavlina
    Pavlina avatar
    6070 posts

    Posted 07 Jul 2011 Link to this post

    Hi Ayberk,

    Based on the provided information it is hard to determine what is the cause of the problem. Can you try preparing a sample project illustrating the problem and send it to us? For that purpose, you will need to open a formal support ticket where you would be able to attach a zipped version of the project.

    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft R3 2016 release webinar banner
Back to Top