I use the following code to server bind igGrid, but it can not work.
@(Html.Infragistics().Grid<System.Data.DataRow>().ID("DataTableId").DataSource(Model.AsQueryable()).DataBind().Render())
How to bind the DataSource with DataTable?
Thanks.
Hello ragnarol ,
Thank you for posting in our forums.
In the below thread is explained how to achieve this using Angel's suggestions:
http://community.infragistics.com/forums/p/64090/324867.aspx#324867
Let us know if you need further assistance.
You need to create some simple class(es) with public properties, and then fill them by traversing the DataRow collection for the data table, and supply the resulting list as a data source for the grid.
The grid does not support binding to DataTables (or a list of DataRow objects) directly , we plan to add this in the future, though.
Thanks,
Angel
I am getting the same problem (AmbiguousMatchException).
Has it being fixed/answered?
Looks like its not being able to bind to a DataRow object.
I have already convert it to IQueryable, but it also throw the exception. Does it not support DataTable?
Do you have the example to bind data with DataTable in Server Side? Because the data from back end are dynamic, so we only can use DataTable with data bind.
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.Reflection.AmbiguousMatchException: Ambiguous match found.Source Error:
Line 16: </table>*@ Line 17: <!--#BEGIN SNIPPET#--> Line 18: @(Html.Infragistics().Grid(Model).ID("DetailsTable").DataSource(Model).DataBind().Render()) Line 19: <!--#END SNIPPET#--> Line 20: </div>
The supported data source type is IQueryable. You can convert your data easily to a List / IQueryable, using extension methods. Example:
dataTable.AsEnumerable().AsQueryable().
Hope it helps,