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

[Solved] Grid binding to DateSet/DataTable support

12 Answers 432 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.
Jason
Top achievements
Rank 1
Jason asked on 15 Jul 2010, 08:46 PM
I noticed a closed (Resolved) ticket on this issue stating it will be in 2010 Q1 +SP, but even in Q2 I do not see this functionality.

Am I missing documentation, is there a work around, should I continue searching the forums?

-Jason

12 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Jul 2010, 07:35 AM
Hello Jason,

I am sending you a sample project showing binding to DataTable. However there are a few important limitations:
  1. Editing is not supported in this mode as there is no way to set the data keys (they need strongly typed expressions)
  2. Filtering does not work (perhaps we would implement DataTable filtering support in the future)
  3. Only server binding is supported because of the inability of the JavaScriptSerializer object to serialize a DataTable as JSON.

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
Jason
Top achievements
Rank 1
answered on 20 Jul 2010, 06:09 PM
Thank you, I appreciate it. =)

-Jason
0
Jason
Top achievements
Rank 1
answered on 22 Jul 2010, 08:44 PM
One last question. Normal column binding will not work in my case as we have very dynamic data (fiscal reporting) where the months / years / etc changes with each report. I thought I could get around this issue with...

<%= Html.Telerik().Grid<System.Data.DataRow>(Model.ReportModel.Data.Rows.Cast<System.Data.DataRow>())
       .Name("Grid")
         .Columns(columns =>
         {
           foreach (System.Data.DataColumn temp in Model.ReportModel.Data.Columns)
           {
             columns.Bound(temp.DataType, temp.ColumnName);
           }
         })
       .Pageable()
       .Sortable()
       .Scrollable()
       .Groupable()
%>

But I get

Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.

The table is made up of only strings.

-Jason
0
Jason
Top achievements
Rank 1
answered on 16 Aug 2010, 06:06 PM
Would like to bump for a solution.

With the code you sent me earlier

<%= Html.Telerik().Grid<System.Data.DataRow>(Model.Rows.Cast<System.Data.DataRow>())
    .Name("Grid")
   .Pageable()
   .Sortable()
   .Scrollable()
   .Groupable()

I would get a grid that is empty with header columns "Row Error", "Row State", and "Has Error" (which is not reflective of my data). Thus I tried modifying the code to what I had in the previous post but got that error.

Any word yet on what might be going on, do you need more information?

-Jason

Edit: I have a Json version of my dataset if this would be easier to databind to given I'm doing ajax post backs.
0
Atanas Korchev
Telerik team
answered on 17 Aug 2010, 07:58 AM
Hi Jason,

 I have modified the sample project to generate the columns on the fly. Check it out.

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
Rickard
Top achievements
Rank 1
answered on 21 Oct 2010, 09:19 AM

This example does not work when you add .Filterable()

I can’t find any documentation about the DataTable feature in the Grid. Is it fully supported in MVC Q2 2010?

0
Rosen
Telerik team
answered on 21 Oct 2010, 10:10 AM
Hello Rickard,

Indeed, as mentioned in the original post by my colleague Atanas, the provided sample does not work when filtering is enabled. 

However, I'm happy to inform you that we are working on few improvements (such as support for filtering and ajax binding) when binding to a DataTable. They will be available with the Q3 2010 release of Telerik Extensions for ASP.NET MVC. 

Greetings,
Rosen
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
Alex
Top achievements
Rank 1
answered on 07 Apr 2011, 03:00 AM
Hello, I did discover a way to get ajax binding to work on a dynamic datatable. I send the model an empty datatable so the grid can get the columns. I then converted the datatable into a dictionary object, then I use custom paging to retrurn the data.

I have a sample application on my site http://alexrogan.com/?p=13
0
ajmal
Top achievements
Rank 1
answered on 22 Apr 2011, 12:58 PM
Hello Alex/All Expert,

Is there any work around for client side binding "onDataBinding"?

i'm looking for the client binding ?

Thanks,
Ajmal
0
Simon
Top achievements
Rank 1
answered on 23 Nov 2011, 11:45 AM
@Alex: Please mark your post as obsolete because it is possible to use a normal datatable and pass it via GridModel to the client, no need to transform it in an Enumerable. I found this because I tried to implement sorting and filtering in your solution. I attached a sample project to prove this!

Regards
Simon
0
Irwin
Top achievements
Rank 1
answered on 01 Feb 2012, 05:12 PM
Does this solution also work with Editing now or is that still unsupported?  I tried to add editing using

.Editable(editing => editing.Mode(

 

GridEditMode.InLine))

 


But that caused an error.

Is there a solution to dynamicly add columns, and also allow editing?

thanks,
Irwin
0
Michael
Top achievements
Rank 1
answered on 29 Feb 2012, 08:05 PM
Hi,

I'm using the latest sample code in this thread to bind my DataTable.  When I have a space in my column names, I get this error:
"Microsoft JScript compilation error: Expected ';'"

Anyone else experience the same issue?
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jason
Top achievements
Rank 1
Rickard
Top achievements
Rank 1
Rosen
Telerik team
Alex
Top achievements
Rank 1
ajmal
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Irwin
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or