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

RadGrid and Paging/Sorting with DataSource

6 Answers 496 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LEWINA
Top achievements
Rank 1
LEWINA asked on 03 Apr 2009, 09:39 PM

I have a RadGrid where I do not use an ObjectDataSource but set its DataSource programmatically with a DataSet. I have turned on both sorting and paging and have experienced a problem. When I page through the results, everything is fine. However, if I click on a column to sort the data and then click on a page number, I receive the following error:

index 10 is either above negative or above rows count radcontrol

"10" is the page size of my RadGrid.

I have used paging and sorting together in a regular GridView where an ObjectDataSource was not used, and I had to add custom coding to handle the sorting and paging events. Is there anything special I have to do when using sorting and paging with the RadGrid and a programmatic datasource? If so, do you have any example code. I couldn't find anything in the documentation about this.

Because I am using a programmatic data source, I have to reload the data each time a grid page is changed or sort is called. But I am not doing anything more than that at this time. Do I need to reset the CurrentPageIndex or other properties so that the sorting doesn't conflict with the paging? Also, the sorting and paging are not being done by a postback but through Ajax. Is there something on the client side that might explain this problem? (By the way, how can I turn off Ajax and just have the sorting and paging occur through postbacks? I can't seem to find the EnableAjax property in the RadGrid control.)

Any help would be greatly appreciated.

Here is a snippet of the code:

 

<telerik:RadGrid runat="server" ID="grdSchool" AllowPaging="True" AutoGenerateColumns="False"

 

 

GridLines="None" Skin="aspire" EnableEmbeddedSkins="false" PageSize="10" Width="100%"

 

 

OnItemDataBound="grdSchool_ItemDataBound" OnItemCommand="grdSchool_ItemCommand"

 

 

AllowSorting="True" OnSortCommand="grdSchool_OnSort" OnDeleteCommand="grdSchool_DeleteCommand"

 

 

OnPageIndexChanged="grdSchool_PageChanged" PagerStyle-Mode=NextPrevAndNumeric>

 

 

<MasterTableView>

 

etc.

The grdSchool_OnSort and grdSchool_PageChanged methods simply get the data from the session, set the DataSource, and then rebind.



6 Answers, 1 is accepted

Sort by
0
LEWINA
Top achievements
Rank 1
answered on 06 Apr 2009, 02:19 PM
Can anyone from Telerik assist us with this question? We need to resolve this as soon as possible. We have seen a similar error message in other Telerik forum posts that indicate this might be some kind of bug with the Telerik product, but we are not sure. We have tried a number of different things to resolve this issue, but nothing has worked so far. We would prefer not to have to redo our code to use an ObjectDataSource in this instance. If this is not a bug and there is a simple way to handle both sorting and paging together without using an ObjectDataSource, we would appreciate some details on how to do this.

If you require any further information, please let us know.

Thanks
Anthony
0
Sebastian
Telerik team
answered on 06 Apr 2009, 04:44 PM
Hello Anthony,

Can you please verify that you are using the latest version 2009.1.402 of RadControls for ASP.NET AJAX in your project? The issue has been reported for the official Q3 2008 release of the suite, however it should be address in the subsequent service packs/major versions.

Another thing you may try is to set the OverrideDataSourceControlSorting property of the master table to true and utilize the built-in paging of the ObjectDataSource control as demonstrated on this online demo of the product.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
LEWINA
Top achievements
Rank 1
answered on 06 Apr 2009, 07:43 PM

Hi Sebastien,

 

We are using a version earlier than the Q3/08 release. The dates on the DLL files are from May to June 08. If we implement the latest version of the controls, will the paging and sorting work properly - i.e. bug free - in the case where ObjectDataSource is not used? As mentioned in our original post, we are not using an ObjectDataSource, but are creating a dataset and simply setting the grid datasource property to point to the dataset. Is there anything else we will need to do from a programmatic perspective, or should paging and sorting work fine?

Thanks
Anthony

0
Sebastian
Telerik team
answered on 07 Apr 2009, 08:17 AM
Hello Anthony,

Thank you for the clarification. I believe that migrating even to the Q3 2008 SP2 release of the suite (2008.3.1314) should address the error you receive. The paging and sorting functionality of the control should work properly regardless whether you pass a dataset or datatable as grid source in its NeedDataSource event hander when using advanced binding.

Greetings,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
LEWINA
Top achievements
Rank 1
answered on 07 Apr 2009, 08:26 PM

Hi Sebastien,

 

We upgraded to the Q1 2009 version. it fixed the problem. However, it introduced many more problems. None of our custom skins works any more. We have also noticed a number of other issues that we really don't want to have to deal with right now. Reading through the forums and blog entries, we didn't get a good impression of the Q1 release. We are considering backing out the Q1 release and installing the Q3 2008 release. Will that fix the original problem we mentioned and let us use our existing skins? Is this the best approach?

 

Thanks

Anthony

 

0
Sebastian
Telerik team
answered on 08 Apr 2009, 08:15 AM
Hello Anthony,

Please have in mind that we modified the built-in skins of the products to unify their css naming conventions and improve their appearance. Hence if you intend to use the old versions of the skins with the new release, you will need to convert them using the skin convertion tool we created:

http://blogs.telerik.com/tervelpeykov/posts/09-03-20/using_pre-q1_2009_skins_with_q1_2009.aspx
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/all-radcontrols-q3-2008-skins-are-now-compatible-with-the-q1-2009-release.aspx

I also recommend you review the general 'Changes and backwards compatibility' topic from the documentation for more details info about the changes we made in the Q1 2009 release of the suite:

http://www.telerik.com/help/aspnet-ajax/radcontrols-changes-backwards-compatibility.html

Of course, you can stick to the Q3 2008 SP2 release (v.2008.3.1314) in case you do not want to perform these actions yet. It should address the issue you depicted.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
LEWINA
Top achievements
Rank 1
Answers by
LEWINA
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or