Replies
Hi Jay,
I looked into how you could handle this situation where you don’t know what the properties are in the objects and I came up with the following solution:
Since you’re using Silverlight you should have access to the JsonValue class. You need to add a reference to the System.Json assembly in order to get it. Once you have this class, you can use the JsonValue.Parse method to parse the data into KeyValuePairs. From these pairs you would need to create a column for the XamGrid and assign the Key property. You can then directly set the JsonValue to the XamGrid.ItemsSource. You must make sure that you set XamGrid.AutoGenerateColumns to false for this to work. I’ve attached a sample that demonstrates this.
Attachments:
Hi Jay,
The XamGrid requires some sort of IEnumerable of a known type in order to bind to it. This means you need to create a class type that will contain the data inside the JSON string and give the grid a collection of this class. For example, take the following JSON:
[{"Name":"John Doe", "Email":"johnd@hotmail.com"},{"Name":"Mary Doe", "Email":"maryd@hotmail.com"}]
This JSON has two objects containing a 'Name' and 'Email' field so we need a class to contain these properties.
public class Person { public string Name { get; set; } public string Email { get; set; } }
You then need to parse the JSON and store the values in the Person class and then stick it inside a collection.
List<Person> people = ParseJSON(jsonString); xamGrid1.ItemsSource = people;
Deserializing the JSON into a class can be done using the DataContractJsonSerializer. This article discusses this: http://www.silverlightshow.net/items/JSON-serialization-and-deserialization-in-Silverlight.aspx
Hi Graeme,
Let me know if you have any further questions on this matter.
Hi Graeme,
Page numbers are solved automatically by the reporting engine so unfortunately there is no way to modify them externally. This would require an internal change to the product.
Since this is not currently supported this is a great candidate for a new product idea. If you'd like to see this idea implemented in the future, please head on over to our new products idea website and add an entry for it under Reporting. http://ideas.infragistics.com/
Let me know if you have any questions on this.
Hi Paul,
I've created a private case for you so that I may send you a sample using MVC and IG Reporting to load and display a report. The project size is a bit to large to upload here on the forums.
Your case number is CAS-105341-S8G1T3 and you can view it online here: https://www.infragistics.com/my-account/support-activity
Hi Paul,
What does your web.config look like? What dlls is it referencing? That error makes it sound like it doesn't have the appropriate reporting dlls loaded where that namespace would be located.