0
I’m probably doing something wrong, and I must have made a mistake doing the loop, but come on.
I have a class called 'Class.Cs' that has the following code:
[JsonProperty("A")]
public string A{ get; set; }
[JsonProperty("B")]
public string B{ get; set; }
[JsonProperty("C")]
public string C{ get; set; }
I did it this way, because of the JSON returns. So, when it comes to deserialize, I only inform the class and the object of the Array.
However, I need to play this on a GRID that has columns with different Class names. Ex.: First Column -> Data A that must receive the value A {get; set;}
To be more exact, the component is the Metrogrid of the Metroframework. If necessary, I can change it to Datagridview (Visual Studio Tools itself)
I had tried to make a loop, informing each item of the List<>, for the name of the Column, however, it informs me that it is not possible to do this process.
If I use the code below:
mtrgrdDataGrid.DataSource = JsonConvert.DeserializeObject<List<Classe>>(strDados);
It fills the Datagrid according to the object column.
How to fill this Datagrid, however, with custom names in the columns?
I ended up choosing to use the last option. I switched the component to Datagridview, and did just that from there. And voila, it fell like a glove.
– Eymard Silva
do not forget to mark as response
– Rovann Linhalis