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

[Solved] Populate MVC grid from XML

3 Answers 46 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.
Eugene O Sullivan
Top achievements
Rank 1
Eugene O Sullivan asked on 09 Nov 2009, 01:29 PM
Hi, Just wondering if it's possible to populate the mvc grid from xml. Basically what I want to try to do is generate the grid based on the xml file passed to it and so depending on the xml file it will have different columns so I can't really bind it to an object as the examples show.

Is this possible, thanks in advance

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 09 Nov 2009, 02:04 PM
Hello Eugene O Sullivan,

It is possible to bind the grid to xml. Unfortunately there is one important limitation - since XML attributes are not properties the grid currently cannot perform the built-in sorting or filtering.

Find attached a sample project showing the relevant code (int Index.aspx and HomeController.cs).

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
Eugene O Sullivan
Top achievements
Rank 1
answered on 09 Nov 2009, 02:12 PM
Thanks for your reply, thats great, although it would limit the benefit of putting it in a grid to lose sorting. Would converting the XML to a dataset/datatable in the background and passing that to the grid work?
0
Atanas Korchev
Telerik team
answered on 09 Nov 2009, 02:22 PM
Hi Eugene O Sullivan,

No, sorting and filtering will still not work. For the time being only properties should be specified when using the build in sorting and filtering. The only workaround is to use custom binding.

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.
Tags
Grid
Asked by
Eugene O Sullivan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Eugene O Sullivan
Top achievements
Rank 1
Share this question
or