I am using version 2009.3.1103.0. Does the GridModel only work with 2009.3.1221 ?
thanks
18 Answers, 1 is accepted
The latest official version is 2009.3.1320 - Q3 2009 SP2. You can find more info in this blog post.
Regards,
Atanas Korchev
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.
Does the GridModel only work with 2009.3.1221 and above ?, or, should it work with 2009.3.1103.0 as well ?
GridModel should be working in all versions. I suggest you check the server output using fiddler or firebug to get the actual error message (500 means server error and is probably due to some exception).
Regards,
Atanas Korchev
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.
So, fiddler shows me this error message .....
Server Error in '/' Application.
A circular reference was detected while serializing an object of type 'System.Data.Metadata.Edm.AssociationType'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Data.Metadata.Edm.AssociationType'.
Source Error:
After looking it up on the web, I found this post ...
http://blogs.microsoft.co.il/blogs/idof/archive/2008/09/30/serializing-entity-framework-object-to-json.aspx
So, my question now is ..
If GridModel has serialization issues when working with Entity Framework objects, what might be another
way to accomplish this task ?
Here is how I am currently trying to use it ...
This is my partial view ....
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<BCAnalytics.Models.Company>>" %> |
| <%= Html.Telerik().Grid(Model) |
| .Name("Company") |
| .Pageable(pager => pager.PageSize(1)) |
| .Columns(columns => |
| { |
| columns.Add(o => o.coMemberNo).Width(50); |
| columns.Add(o => o.coCompanyNo).Width(50); |
| columns.Add(o => o.coCompanyName).Width(50); |
| columns.Add(o => o.coAddress1).Width(100); |
| columns.Add(o => o.coCity).Width(50); |
| }) |
| .Ajax(settings => settings.Action("_AjaxBinding", "Work")) |
| %> |
This is my action method ....
| [GridAction] |
| public ActionResult _AjaxBinding() |
| { |
| BCAEntities nw = new BCAEntities(); |
| // GridModel<> is from telerik.web.mvc |
| return View(new GridModel |
| { |
| Data = nw.Company |
| }); |
| } |
Again, I am using Entity Framework, not LINQ to SQL. Maybe there is another way to do this ?
thanks again for the great advice, Fiddler does more than I thought. .
I would suggest you use ViewModel objects and bind the grid to them instead. You can check my blog post for additional info. Just make sure you include all the key properties (primary keys in the DB that is) in the ViewModel object because they are required by entity framework.
Regards,
Atanas Korchev
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.
Is it because Entity Framwork objects cannot be serialized that I have to use this ViewObject scenerio ?
Using the viewobject scenerio adds a little more code (not to much), but some. My sample is just one Grid for one table. I have several Grids I will need to create for several tables.
Is there a more direct way of doing ajax binding with Entity Framework classes ? If not, then I guess I have no choice. I am trying to achieve the smooth paging that ajax allows in my MVC project, perhaps there is another way of pursuing this result ?
thanks for your help
I have create a new blog post explaining the reason for such kind of issues (it is not binding to entity framework per se). There is another solution which does not require creating ViewModel objects. Please check it out.
Regards,
Atanas Korchev
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.
Thanks for the link.
Unfortunatly with Entity Framework, I get this error ....
| Server Error in '/' Application. |
| -------------------------------------------------------------------------------- |
| The argument to DbIsNullExpression must refer to a primitive or reference type. |
| Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
| Exception Details: System.ArgumentException: The argument to DbIsNullExpression must refer to a primitive or reference type. |
| Source Error: |
| Line 1: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<BCAnalytics.ViewModels.CompanyVM>>" %> |
| Line 2: |
| Line 3: <%= Html.Telerik().Grid(Model) |
| Line 4: .Name("Company") |
| Line 5: .Pageable(pager => pager.PageSize(1)) |
| Source File: c:\IQSys\BCAnalytics_Entity_Framework\BCAnalytics\BCAnalytics\Views\Work\CompanyGridAjax.ascx Line: 3 |
| Stack Trace: |
| [ArgumentException: The argument to DbIsNullExpression must refer to a primitive or reference type.] |
| System.Data.Common.CommandTrees.DbIsNullExpression..ctor(DbCommandTree cmdTree, DbExpression arg, Boolean isRowTypeArgumentAllowed) +3689009 |
I see that others in the Telerik Community have had the same issue with the ViewModel scenerio within EF as well. From searching around, it looks like this may be an Entity Framework issue ? I hope this does not mean we cannot use this telerik functionality within EF ?
Is there another suggestion for allowing the Ajax Binding to work with Entity Framework ?
thanks for your time
We haven't reproduced this error so far albeit we have done many tests with EF. I am attaching a running sample for your reference.
Let us know if you find any differences between it and our test project.
Regards,
Atanas Korchev
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.
I am having the same issue with Nhibernate, any suggestions on how to solve it?
Hi Psycho,
I looked at the terrible notes I mad on this and here is what I wrote for myself in case it happened again. (I dont use N-Hibernate though) .....
"When i first got this error, it was because I needed to use the telerik version that had the fix - 2009.3.1320. This went for scripts and content as well. Telerik.web.mvc.dll for this version has to be in the references.
If its not, you have to add it as a reference and do a "Clean" and "Rebuild". When you do the clean it should remove the dll from your bin folder as well - yep, it goes to your bin and deletes old files. at that point, you may have to add it manually to the bin, and make sure its referenced and then you do a build.
NOW THIS WAS A JUMBLED SEQUENCE OF EVENTS, BUT MAKING SURE THE DLL VERSION WAS REFERENCED, CLEANED AND REBUILT (not neccessarily in that order) fixed it. "
Psycho, basically, I guess I needed to use this version (of course 2010.1.309 is out now), and, had to make sure it was referenced (not just in the BIN - not sure why), then, I cleaned and rebuilt the project - hope this helps.
iqworks -
Hi Psycho,
I looked at the terrible notes I mad on this and here is what I wrote for myself in case it happened again. (I dont use N-Hibernate though) .....
"When i first got this error, it was because I needed to use the telerik version that had the fix - 2009.3.1320. This went for scripts and content as well. Telerik.web.mvc.dll for this version has to be in the references.
If its not, you have to add it as a reference and do a "Clean" and "Rebuild". When you do the clean it should remove the dll from your bin folder as well - yep, it goes to your bin and deletes old files. at that point, you may have to add it manually to the bin, and make sure its referenced and then you do a build.
NOW THIS WAS A JUMBLED SEQUENCE OF EVENTS, BUT MAKING SURE THE DLL VERSION WAS REFERENCED, CLEANED AND REBUILT (not neccessarily in that order) fixed it. "
Psycho, basically, I guess I needed to use this version (of course 2010.1.309 is out now), and, had to make sure it was referenced (not just in the BIN - not sure why), then, I cleaned and rebuilt the project - hope this helps.
iqworks -
Go to: http://demos.telerik.com/aspnet-mvc/grid/custombinding, and click on page 2 for example and see.
There was a problem with the demo that has been fixed. You can check it now.
Regards,
Atanas Korchev
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.
The problem, which you observed, was caused by the incorrect set of the data rows count. You can review this online demo for more information. Note the newly added private static count variable, which is set in the
GetData method before paging.
Kind regards,
Georgi Krustev
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.
Thanks for your reply. I am wondering why did you choose to make the GetCount method static, any philosophy behind this?