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

[Solved] Can GridModel be used with version 2009.3.1103.0

18 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
IQworks
Top achievements
Rank 1
IQworks asked on 22 Jan 2010, 03:26 AM
 When using ajax binding, I get "The requested URL "/ /" returned 500 - internal server error". 
 I am using version 2009.3.1103.0. Does the GridModel only work with 2009.3.1221 ?
 thanks

18 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 22 Jan 2010, 03:49 AM
is 2009.3.1221   the latest version of telerik mvc ?
0
Atanas Korchev
Telerik team
answered on 22 Jan 2010, 08:48 AM
Hello IQworks,

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.
0
IQworks
Top achievements
Rank 1
answered on 22 Jan 2010, 03:22 PM
  Thanks, Ok, back to my original question. 
  Does the GridModel only work with 2009.3.1221 and above ?, or, should it work with 2009.3.1103.0 as well ?
0
Atanas Korchev
Telerik team
answered on 22 Jan 2010, 03:48 PM
Hello IQworks,

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.
0
IQworks
Top achievements
Rank 1
answered on 22 Jan 2010, 08:16 PM
Great advice !!
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 ..

After looking it up on the web, I found this post ...  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. .

0
Atanas Korchev
Telerik team
answered on 25 Jan 2010, 08:46 AM
Hi IQworks,

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.
0
IQworks
Top achievements
Rank 1
answered on 25 Jan 2010, 07:11 PM
  Hi Atanas,
      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
     
0
Atanas Korchev
Telerik team
answered on 26 Jan 2010, 08:04 AM
Hi IQworks,

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.
0
IQworks
Top achievements
Rank 1
answered on 30 Jan 2010, 12:17 AM
Hi Atanas,
    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
0
Atanas Korchev
Telerik team
answered on 01 Feb 2010, 08:47 AM
Hi IQworks,

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.
0
Psycho Nelo
Top achievements
Rank 1
answered on 20 Mar 2010, 06:35 PM
Hi,
I am having the same issue with Nhibernate, any suggestions on how to solve it?
0
IQworks
Top achievements
Rank 1
answered on 21 Mar 2010, 05:03 AM

  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 -

0
IQworks
Top achievements
Rank 1
answered on 21 Mar 2010, 05:04 AM

  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 -

0
Psycho Nelo
Top achievements
Rank 1
answered on 21 Mar 2010, 02:00 PM
Version 2010.1.309 is faulty, paging in custom server binding doesnt work, even on your online samples:
Go to: http://demos.telerik.com/aspnet-mvc/grid/custombinding, and click on page 2 for example and see.
0
Atanas Korchev
Telerik team
answered on 22 Mar 2010, 10:43 AM
Hello,

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.
0
Psycho Nelo
Top achievements
Rank 1
answered on 22 Mar 2010, 08:57 PM
I still have the same problem with the demos which come with the release, what did you do to fix it?
0
Georgi Krustev
Telerik team
answered on 23 Mar 2010, 09:43 AM
Hello Psycho Nelo,

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.
0
Psycho Nelo
Top achievements
Rank 1
answered on 23 Mar 2010, 10:31 AM
Hello Georg,
Thanks for your reply. I am wondering why did you choose to make the GetCount method static, any philosophy behind this?
Tags
Grid
Asked by
IQworks
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
Atanas Korchev
Telerik team
Psycho Nelo
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or