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

[Solved] AJAX Filtered Data server side?

9 Answers 269 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.
Robert Mullen
Top achievements
Rank 1
Robert Mullen asked on 02 Feb 2010, 04:55 PM
I have a grid on page that allows filtering by several columns. This grid uses AJAX for all intrinsic action. The user can also download EXCEL data represented in the grid by going back to the server and calling a data routine. This doesn't reflect the filters or the sorts though as they are handled by the grid. Is there a way to access the current data in the grid from the controller? I can see the actual filter and sort statements but would not like to parse and apply these manually as it would be error prone. Is there a better way to handle EXCEL creation (simple CSV)?

9 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 03 Feb 2010, 09:53 AM
Hi Robert Mullen,

I have prepared a sample project to demonstrate how to do that.

I hope this helps,
Atanas Korchev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Robert Mullen
Top achievements
Rank 1
answered on 03 Feb 2010, 06:35 PM
What version on VS is this created on? I have used VS2010 Beta and VS2008 and neither will open it. They complain about the csproj file. I did poke around the files a bit though and see a call to Model().ToGridModel(int, int, string, string).Data which is the core of what I need. I can't open the project fully so I can't tell where this code comes from and it does not work in my project. Can you give me the namespace for that object or a pointer to which project CS file contains it?

TIA
0
Atanas Korchev
Telerik team
answered on 04 Feb 2010, 08:00 AM
Hi Robert Mullen,

This project was created with VS2008 and I am able to successfully open it. It is very strange why you can't. Anyway the ToGridModel() extension method is in the Telerik.Web.Mvc.Extensions namespace.

Regards,
Atanas Korchev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
James Davies
Top achievements
Rank 1
answered on 04 Feb 2010, 08:57 AM
Hi Robert,

I can Open / Build / Run this in VS2008 with no problems (see below).
 
I get IntelliSense on the ToGridModel() call, and the following in the CSV file (with no filtering):

OrderID,OrderDate
10248,04/07/1996 00:00:00
10249,05/07/1996 00:00:00
10250,08/07/1996 00:00:00
10251,08/07/1996 00:00:00
10252,09/07/1996 00:00:00
10253,10/07/1996 00:00:00
10254,11/07/1996 00:00:00
10255,12/07/1996 00:00:00
10256,15/07/1996 00:00:00
10257,16/07/1996 00:00:00

and the following if I use a filter (Order ID < 10255):

OrderID,OrderDate
10248,04/07/1996 00:00:00
10249,05/07/1996 00:00:00
10250,08/07/1996 00:00:00
10251,08/07/1996 00:00:00
10252,09/07/1996 00:00:00
10253,10/07/1996 00:00:00
10254,11/07/1996 00:00:00

    Hope this helps,
    Jim


------ Build started: Project: MvcApplication3, Configuration: Debug Any CPU ------

C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Entity.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Linq.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Security.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Abstractions.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Mobile.dll /reference:"C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 1.0\Assemblies\System.Web.Mvc.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Routing.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:Binaries\Telerik.Web.Mvc.dll /debug+ /debug:full /optimize- /out:obj\Debug\MvcApplication3.dll /resource:"F:\Documents and Settings\Jim\Local Settings\Temp\tmp12A.tmp",Models.Northwind.csdl /resource:"F:\Documents and Settings\Jim\Local Settings\Temp\tmp12C.tmp",Models.Northwind.ssdl /resource:"F:\Documents and Settings\Jim\Local Settings\Temp\tmp12B.tmp",Models.Northwind.msl /target:library Controllers\AccountController.cs Controllers\HomeController.cs Default.aspx.cs Global.asax.cs Models\Asset.cs Models\LinqNorthwind.designer.cs Models\Northwind.Designer.cs Models\OrderViewModel.cs Models\Product.cs Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings

MvcApplication3 -> G:\Downloads\T\Telerik\Samples\172240_mvcapplication3\MvcApplication3\bin\MvcApplication3.dll

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

0
Robert Mullen
Top achievements
Rank 1
answered on 04 Feb 2010, 04:14 PM
I still can't open it but it may be because my bits are not completely current. I have not upgraded to the latest Telerik release as I am trying to forestall the upgrade until the final MVC 2 release is made. I don't need the project necessarily but right now I can't get the extensions to work. I have added the Telerik Extensions in using but I don't get the ToGridModel on my IQueryable. Could be my old bits or could be something else. I am going to poke around and see if I have any other incompatibilities. Nothing has jumped out at me so far though.
0
Robert Mullen
Top achievements
Rank 1
answered on 04 Feb 2010, 05:50 PM
No love getting the project to work but I did get the example out file by file and got it to work in my project. Not sure what is going on with the sample but it must be specific to my bits.

Thanks.
0
Robert Mullen
Top achievements
Rank 1
answered on 05 Mar 2010, 10:09 PM
Atanas,
Do these methods change in the futures release? I am working with the new grid and not getting the clients side object model as expected. Specifically my filterExpression comes back empty now.

TIA
0
Atanas Korchev
Telerik team
answered on 08 Mar 2010, 08:20 AM
Hello Robert Mullen,

The filterExpression field has been renamed to "filterBy".

All the best,
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
Scott
Top achievements
Rank 1
answered on 01 Feb 2013, 06:40 PM
Robert,

I know this is an old thread, but thought I would comment anyway.
I had the same issue getting the project to open or build. (I was running Windows 7)
Ran VS2010 as administrator, converted the project, and all is well.

Perhaps this will help the next guy. :)
Tags
Grid
Asked by
Robert Mullen
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Robert Mullen
Top achievements
Rank 1
James Davies
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Share this question
or