RadDataPager not working after filterexpression

4 posts, 0 answers
  1. Alex
    Alex avatar
    1 posts
    Member since:
    Jan 2009

    Posted 05 Jul 2011 Link to this post

    Hi, I'm using raddatapager for my radlistview, the paging function works fine and filter functions works fine, as long as you don't use them at the same time. but all the paging function stops working after filterexpression gets call, here is source code:
    aspx:
    <telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ItemContainer"
        AllowPaging="True" DataSourceID="LinqDataSource1"
        OnDataBound="RadListView1_DataBound">
        <LayoutTemplate>
            <asp:PlaceHolder ID="ItemContainer" runat="server" />
            <div class="test">
                <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
                    EnableEmbeddedBaseStylesheet="false" PageSize="15" BackColor="#EEF5FB" BorderWidth="0"
                    EnableEmbeddedSkins="false" EnableTheming="false" CssClass="pp">
                    <Fields>
                        <telerik:RadDataPagerButtonField FieldType="Prev" />
                        <telerik:RadDataPagerButtonField FieldType="Next" />
                        <telerik:RadDataPagerTemplatePageField>
                            <PagerTemplate>
                                <asp:Button runat="server" ID="previousButton" CommandName="Page" CommandArgument="Previous"
                                    Text="Previous" CssClass="PagerButton NextPage previousArrow" />
                            </PagerTemplate>
                        </telerik:RadDataPagerTemplatePageField>
                        <telerik:RadDataPagerButtonField FieldType="Numeric" />
                        <telerik:RadDataPagerTemplatePageField>
                            <PagerTemplate>
                                <asp:Button runat="server" ID="nextButton" CommandName="Page" CommandArgument="Next"
                                    Text="Next" CssClass="PagerButton NextPage linkArrow" />
                            </PagerTemplate>
                        </telerik:RadDataPagerTemplatePageField>
                    </Fields>
                </telerik:RadDataPager>
            </div>
        </LayoutTemplate>
        <ItemTemplate>

                    <div class="resourceItemHeader">
                        <asp:HyperLink ID="HeaderLink" runat="server" Target="_blank" Text='<%#Eval("Name") %>'
                            NavigateUrl='<%#Eval("Url") %>'></asp:HyperLink>
                    </div>
     
        </ItemTemplate>
    </telerik:RadListView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MHBCore.Data.MHBCoreDataContext"
        EntityTypeName="" TableName="ViewResourceItemJoinCategory">
    </asp:LinqDataSource>

    aspx.cs
        public int TypeId { get; set; }
        public int TopicId { get; set; }
        public int ExamId { get; set; }
        public string SearchKey { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadListView1.CurrentPageIndex = 0;
                Load();
            }
        }

        public void Load()
        {
            RadListView1.FilterExpressions.Clear();
            if (TypeId > 0)
                RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("ResourceTypeId") { CurrentValue = TypeId });

            if (TopicId > 0)
                RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("TopicId") { CurrentValue = TopicId });

            if (ExamId > 0)
                RadListView1.FilterExpressions.Add(new RadListViewEqualToFilterExpression<int>("CategoryId") { CurrentValue = ExamId });

            if (!string.IsNullOrWhiteSpace(SearchKey))
                RadListView1.FilterExpressions.BuildExpression(expression => expression.Contains("Name", SearchKey).Or().Contains("TopicName", SearchKey).Or().Contains("Description", SearchKey));
            else
                RadListView1.FilterExpressions.BuildExpression();
            
            RadListView1.Rebind();

            RadListView1.FindControl("RadDataPager1").Visible = RadListView1.PageCount > 1;

        }

    I got an javascript error, after I clicked "next" button:
    Error: Sys.WebForms.PageRequestManagerServerErrorException: Identifier expected
    Source File: http://localhost:90/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_Header1_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ac9d03845-da3c-45e9-ab05-79ee502af576%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.826.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ad48d12ba-bfe2-4fcc-856e-a7c7557f0453%3a16e4e7cd%3addbfcb67%3a4a0008d8
    Line: 15
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Jul 2011 Link to this post

    Hello Li,

    Please review the following online demo which demonstrates similar scenario and works as expected. Test it on your side and verify what the difference in your case is.



    Best wishes,
    Maria Ilieva
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kalpesh
    Kalpesh avatar
    8 posts
    Member since:
    Nov 2013

    Posted 28 Nov 2013 Link to this post

    Hi Maria,

    I also have the same problem - paging (in my case - when I try to access previous pages - I am on 3rd page and try to go to 2nd page it throws the JS error.) not working properly.

    So please look into this issue - we might be missing something. I have checked the demo on the site and it is working fine but in our case it is error out. Please assist.

    Thanks.
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Dec 2013 Link to this post

    Hello Kalpesh,

    It will be best if you could open a separate support ticket and send us runnable version of your application which demonstrates the exact error you are getting in this scenario. Thus we will be able to debug it locally and advise you further.

    Regards,
    Maria Ilieva
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top