RadGrid's paging section not refreshing

10 posts, 0 answers
  1. Yosief
    Yosief avatar
    26 posts
    Member since:
    Mar 2008

    Posted 18 Aug 2010 Link to this post

    Hello All

    I have a problem with a RadGrid where the paging section is not refreshing. If, for example, the first search returns 15 records and the second search only 5 records, I see '... page 1 of 2...' in the second search which is incorrect info caused by the paging section of the grid not refreshing. My page count is set to 10 records. That means there should be only one page in the second search.

    Please help as soon as possible.
    Thank you!

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 19 Aug 2010 Link to this post

    Hello Yosief,

    The provided information is not enough for isolating the root cause of the issue you are facing. I would suggest you to review the following online example and let us know what the difference in your case.

    Best wishes,
    Pavlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yosief
    Yosief avatar
    26 posts
    Member since:
    Mar 2008

    Posted 19 Aug 2010 Link to this post


    Hi Pavlina

    I am using Telerik.Web.UI version 2008.1.415.35 targeting .net 3.5 on Visual Studio 2008.

    I have managed to create a simple page with the same problem. My page gets data from a sample Northwind database. What happens is the user selects a category from a drop-down list and clicks a button to show all products which belong to that category in a RadGrid.

    The 'beverages' category has 12 products which gets displayed in 2 pages of the radgrid. The 'Meat/Poultry' category has 6 products which you would normally expect to show in one page only. (I am using the default page size of 10)

    Here is the tricky part:

    User first selects 'beverages', clicks button and grid correctly displays 12 records in 2 pages. After that user selects 'Meat/Poultry' which gets 6 records. Pager incorrectly says 'Displaying page 1 of 2, items 1 to 10 of 12' which I think is remnant of the previous search where user selected 'beverages'. User clicks 'next page' arrow, grid incorrectly shows the same 6 records again and pager incorrectly says 'Displaying page 2 of 2, items 11 to 12 of 12'.

    This error does not happen when user chooses 'Meat/Poultry' as a first selection on loading of the page. In this case the pager does not display at all which I think is a correct behavior.

    Here is the code:


    ======================================= Default.aspx ========================

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>  
         
        <div>
            <asp:DropDownList ID="CategoryList" runat="server"
                DataSourceID="CategoryDataSource" DataTextField="CategoryName"
                DataValueField="CategoryID">
            </asp:DropDownList>   
         
            <asp:Button ID="GetProducts" runat="server" Text="Get Products"
                onclick="GetProducts_Click" >      
            </asp:Button>
         
            <telerik:RadGrid ID="ProductGrid" runat="server" AllowPaging="True"
                GridLines="None" DataSourceID="ProductDataSource">
                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ProductID">
                        <RowIndicatorColumn Visible="False">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
     
                        <ExpandCollapseColumn Visible="False" Resizable="False">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
     
                        <Columns>
                            <telerik:GridBoundColumn DataField="ProductID" DataType="System.Int32"
                                HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID"
                                UniqueName="ProductID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName"
                                SortExpression="ProductName" UniqueName="ProductName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="QuantityPerUnit"
                                HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit"
                                UniqueName="QuantityPerUnit">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal"
                                HeaderText="UnitPrice" SortExpression="UnitPrice"
                                UniqueName="UnitPrice">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UnitsInStock" DataType="System.Int16"
                                HeaderText="UnitsInStock" SortExpression="UnitsInStock"
                                UniqueName="UnitsInStock">
                            </telerik:GridBoundColumn>
                            <telerik:GridCheckBoxColumn DataField="Discontinued" DataType="System.Boolean"
                                HeaderText="Discontinued" SortExpression="Discontinued"
                                UniqueName="Discontinued">
                            </telerik:GridCheckBoxColumn>
                        </Columns>
     
                    <EditFormSettings>
                    <PopUpSettings ScrollBars="None"></PopUpSettings>
                    </EditFormSettings>
                    </MasterTableView>
            </telerik:RadGrid> 
         
            <asp:SqlDataSource ID="CategoryDataSource" runat="server"
                ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT CategoryID, CategoryName FROM Categories ORDER BY CategoryName">
            </asp:SqlDataSource>   
             
            <asp:SqlDataSource ID="ProductDataSource" runat="server"
                ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                 
                SelectCommand="SELECT ProductID, ProductName, QuantityPerUnit, UnitPrice, UnitsInStock, Discontinued
                               FROM Products WHERE (CategoryID = @CategoryID) ORDER BY ProductName"
                onselecting="ProductDataSource_Selecting">
                <SelectParameters>
                    <asp:ControlParameter ControlID="CategoryList" Name="CategoryID"
                        PropertyName="SelectedValue" />
                </SelectParameters>
            </asp:SqlDataSource>
     
             
            </div>
        </form>
    </body>
    </html>


    ======================================= Default.aspx.cs ========================

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
     
        }
        protected void GetProducts_Click(object sender, EventArgs e)
        {
            ProductGrid.Rebind();
        }
     
        protected void ProductDataSource_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            // cancel binding on first load of page
            if (!IsPostBack)
                e.Cancel = true;
        }
    }

  5. Yosief
    Yosief avatar
    26 posts
    Member since:
    Mar 2008

    Posted 23 Aug 2010 Link to this post


    Any help anyone?
  6. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 24 Aug 2010 Link to this post

    Hi Yosief,

    Thanks for the sample code. However, we cannot reproduce the behavior you are describing. I took the sample code you provided and put it in a sample page following a similar scenario you have. I am attaching the page for your reference. Please let me know if you manage to reproduce what you are getting in this project, and what steps to follow, so that we can test it too.

    All the best,
    Pavlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Yosief
    Yosief avatar
    26 posts
    Member since:
    Mar 2008

    Posted 25 Aug 2010 Link to this post


    Hello Pavlina

    Thanks for your effort.

    Your code works on my pc as well. The problem is it makes use of Telerik.Web.UI version 2010.2.713.35 of which our company has not got a license yet. We only have a license of 2008.1.415.35

    Is there some sort of a workaround that would fix the issue on version 2008.1.415.35?

  8. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 25 Aug 2010 Link to this post

    Hi Yosief,

    Unfortunately we cannot provide a workaround because it is related to modified server code. In order to have the issue fixed you should upgrade to a later version. However, I believe that an upgrade will be useful for you because there are a lot of improvements, bugfixes, new features and even new controls implemented in the latest release compared to the version you are currently using.
    http://www.telerik.com/support/kb/aspnet-ajax/general/updating-radcontrols-for-asp-net-to-another-version-or-license.aspx

    Best wishes,
    Pavlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Carl
    Carl avatar
    3 posts
    Member since:
    Oct 2011

    Posted 16 Jul 2014 in reply to Pavlina Link to this post

    This is still a problem in the 2014.1.402.20 WinForms version.  
    If I have a result of 73 pages and have selected page 50 for example,  
    then reset the grid with a different amount of data with 10 pages for example it shows page 50 of 10 in the Command Bar area?
    (Page x of x). 
    Whenever the next query produces less pages than the previously selected page, the grid does not show data. 
    It should always force the selection to page 1 of x and refresh those objects. 
    Side-stepping this bug, is there a way to manually change the page x of 10.  
    So after the grid is refreshed it would always refresh the page x of 10 to page 1 of 10.  Can I change the x to be 1 and have the grid refresh that way appropriately? 

  10. Carl
    Carl avatar
    3 posts
    Member since:
    Oct 2011
  11. Carl
    Carl avatar
    3 posts
    Member since:
    Oct 2011

    Posted 16 Jul 2014 Link to this post

    I may have found the answer to this.

    Whenever the grid's DataSource is refreshed then do this ...
    this.grdSearch.MasterTemplate.MoveToFirstPage();
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017