This is a migrated thread and some comments may be shown as answers.

RadGrid Paging Problem

7 Answers 547 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lasly
Top achievements
Rank 1
Lasly asked on 08 Oct 2010, 11:15 AM

Hi,

I've a problem with paging on my radgrid.

To fill the DataSource i'm using the event NeedDataSource, and it works.

If i have a lot of rows (>= 100) and I try to change the page, my pager after 11 pages return at the third page..

Why??

If I have under 100 rows the pager works correctly..

This is the block where i put my RadGrid..

01.<telerik:RadGrid ID="grdPorzioni" runat="server" Skin="Sunset" AutoGenerateColumns="false" AllowPaging="true" Width="100%" AllowSorting="false" EnableViewState="false" BorderStyle="None">
02.    <PagerStyle AlwaysVisible="false" Mode="NumericPages" ShowPagerText="false" />
03.    <MasterTableView PageSize="10" AllowPaging="true" AllowSorting="false" ShowHeadersWhenNoRecords="false" TableLayout="Fixed" EnableViewState="false" BorderStyle="Solid" BorderWidth="1">
04.        <NoRecordsTemplate>
05.            <asp:Image runat="server" ID="imgNoRecord" ImageUrl="~/images/__banner.jpg" Width="60%" />
06.            <br />
07.            <asp:Label runat="server" ForeColor="Red" Font-Bold="true" ID="noRecord" Text="Non sono presenti delle porzioni per l'Unità Economica selezionata."></asp:Label>
08.        </NoRecordsTemplate>
09.        <Columns>
10.            <telerik:GridBoundColumn HeaderText="Porzione" DataField="Id" HeaderStyle-Width="100" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
11.            </telerik:GridBoundColumn>
12.            <telerik:GridBoundColumn HeaderText="Descrizione" DataField="Descrizione" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">
13.            </telerik:GridBoundColumn>
14.        </Columns>
15.    </MasterTableView>
16.</telerik:RadGrid>

The Radgrid is inserted into of an ASP panel

Can you help me?

Regards

Cristian

7 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 08 Oct 2010, 01:36 PM
Hello Martini,

In order to avoid this erroneous behavior you should set EnableViewState property of the RadGrid / MasterTableView to true:
ASPX:
<telerik:RadGrid ID="grdPorzioni" runat="server" Skin="Sunset" AutoGenerateColumns="false"
           AllowPaging="true" Width="100%" AllowSorting="false" EnableViewState="true"
           BorderStyle="None">
           <PagerStyle AlwaysVisible="false" Mode="NumericPages" ShowPagerText="false" />
           <MasterTableView PageSize="10" AllowPaging="true" AllowSorting="false" ShowHeadersWhenNoRecords="false"
               TableLayout="Fixed" EnableViewState="true" BorderStyle="Solid" BorderWidth="1">

Paging with disabled control and page ViewState is not supported.
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html

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
0
Lasly
Top achievements
Rank 1
answered on 08 Oct 2010, 02:36 PM

Thanks!!! :)


I've set EnabledViewState to false because i need to reload the data every time the page loads occurs ..now it works correctly...

Regards

Cristian

0
Pavlina
Telerik team
answered on 08 Oct 2010, 03:13 PM
Hello Martini,

I suggest that you examine the project attached in the forum thread below and see if it helps to achieve your goal:
http://www.telerik.com/community/forums/aspnet-ajax/grid/customized-page-size.aspx

Regards,
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
0
Lasly
Top achievements
Rank 1
answered on 08 Oct 2010, 03:18 PM

Thanks..

i've found the problem...

in the code-behind i'm setting the page size.. i've delete this part and now my page size works...

thanks and regards

cristian

0
Pavlina
Telerik team
answered on 08 Oct 2010, 03:24 PM
Hello Martini,

I am glad that you could solve the problem on your own. In case you have additional questions or problems, please do not hesitate to let us know.

Kind regards,
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
0
Prateek
Top achievements
Rank 1
answered on 23 Aug 2011, 03:58 PM
I have to load the data everytime the page loads based on certain conditions.
I turned on the EnableViewState but that does not change anything and I am still having problems with paging.
0
Pavlina
Telerik team
answered on 24 Aug 2011, 03:00 PM
Hello Prateek,

Make sure that you are using AdvancedDataBinding techniques to bind your grid with data. For more information, you can refer to the following online example:
Advanced data-binding

Best wishes,
Pavlina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Lasly
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Lasly
Top achievements
Rank 1
Prateek
Top achievements
Rank 1
Share this question
or