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

Clientside error message on RadGrid

9 Answers 264 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Silver
Top achievements
Rank 1
Silver asked on 17 Jul 2009, 01:54 PM

Hi

I am just looking at the Telerik controls as part of an evaluation for some work I will be carrying out but have come up against an error with the RadGrid control.

I have a simple linqdatasource retrieving a firstname and lastname from a contact list.  I have implemented a radgrid with paging, filtering, sorting and grouping.  The grid brings back the first page of results but I receive the following client side message when I try to navigate to the next page...

sys.webforms.pagerequestmanagerservererrorexception
Exception has been thrown by the target of an invocation

The grid is ajaxified, in a radmultipage that is controlled by a tabstrip.

Any ideas?

thanks

            <asp:LinqDataSource ID="LinqDataSource1" runat="server"
                ContextTypeName="TelerikEvalDbDataContext"
                Select="new (first_name, last_name)"
                TableName="contacts">
            </asp:LinqDataSource>
          

            <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
                AllowPaging="True" AllowSorting="True" DataSourceID="LinqDataSource1"
                GridLines="None" ShowGroupPanel="True" Skin="Vista">
                <MasterTableView DataSourceID="LinqDataSource1">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                </MasterTableView>
                <ClientSettings AllowDragToGroup="True">
                </ClientSettings>
            </telerik:RadGrid>

9 Answers, 1 is accepted

Sort by
0
Silver
Top achievements
Rank 1
answered on 17 Jul 2009, 02:32 PM
...further to this, my data is paged properly if the data is grouped but as soon as I ungroup the data and try to select the paging controls I receive the error.
0
Silver
Top achievements
Rank 1
answered on 20 Jul 2009, 10:10 AM
Any ideas?  Anyone...
0
Georgi Krustev
Telerik team
answered on 23 Jul 2009, 08:04 AM
Hello Silver,

Please examine the attached test project which implements the described functionality. Depending on the given information the RadMultiPage and RadTabStrip are not connected with the issue.

Best wishes,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Silver
Top achievements
Rank 1
answered on 21 Sep 2009, 03:56 PM
Hi

Upgrading from sql 2000 to sql 2005 fixed this issue.

Thanks
0
Ron
Top achievements
Rank 1
answered on 30 Sep 2009, 08:09 PM
Exact same issue.  Any thoughts as to the cause with SQL 2000 but not with 2005?
0
Sebastian
Telerik team
answered on 01 Oct 2009, 08:27 AM
Hi Ron,

I suggest you disable temporary the ajax in order to see the server exception generated in this case as it can shed some additional light on the reason for the issue. You may also examine the sample project provided by my colleague Georgi if you follow the same configuration schema.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Accepted
Ron
Top achievements
Rank 1
answered on 12 Oct 2009, 08:50 PM
This was happening with both paging via RadGrid (using either declarative LINQ DataSourceID and/or setting DataSource in OnNeedDataSource Event using LINQ) and also when retrieving additional data via RadComboBox using a web service.  The Web Service uses a skip() and take() in the query.  Both were generating errors when retrieving new data.  Both scenarios using LINQ to SQL and SQL Server 2000 (Not happening with 2005).  Both using a SQL Server View and generating a DataContext. 

Error:  "This provider supports skip() only over ordered queries returning entities or projections that contain all identity columns, where the query is a single-table (non-join) query or is a Distinct, Except, Insersect or Union (Not CONCAT) operation"
http://msdn.microsoft.com/en-us/library/bb386996.aspx

SOLUTION:
The problem here is that when using SQL Server 2000 and LINQ to SQL for paging (more precisely using the LINQ to SQL Skip() method), the LINQ to SQL DataContext requires that the Primary Key field be included in the query and that the DataContext Column definition have both the attributes IsPrimaryKey=true and the correct AutoSync enumeration (ie AutoSync="AutoSync.OnInsert").  Example:  [Column (Storage="_ID", AutoSync="AutoSync.OnInsert", IsPrimaryKey=true, DbType="Int NOT NULL IDENTITY"....)].

I am using SQL Views and generated the DataContext by "dragging" the views onto the dbml designer.  Although I have the PrimaryKey Column included in the views, the DataContext generated for the views did not automatically add the AutoSync and IsPrimaryKey attributes to the PrimaryKey columns. 

Manually adding the attributes fixed the problem.  Simple way was to select the column on the view in the ClassDesigner and using the properties tab set the Primary Key to true and AutoSync to appropriate enumeration (can do this in code with designer.cs manually as well). 

Note that changes will be overwritten if the view is automatically regenerated again and above changes will need to be manually added again.
0
Sebastian
Telerik team
answered on 13 Oct 2009, 07:39 AM
Hello Ron,

Thank you for sharing the solution you found in this public forum thread - thus you can help other Telerik community members who stumble upon the same problem. I updated your Telerik points for the valuable feedback.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Cheri
Top achievements
Rank 1
answered on 24 Jan 2011, 05:32 PM
Hi Ron,

Thank you so much for your thorough and detailed response.  You've saved me many hours of hair pulling!
Tags
Grid
Asked by
Silver
Top achievements
Rank 1
Answers by
Silver
Top achievements
Rank 1
Georgi Krustev
Telerik team
Ron
Top achievements
Rank 1
Sebastian
Telerik team
Cheri
Top achievements
Rank 1
Share this question
or