I have a class named Agent:
public class Agent
{
public string Measure { get; set; }
}
I have a Datatable, whose columns are dynamic (different every time from database except "Measure" column)
For Example:
Measure | Dexter | Jordon | Ana | Polark |
Login hour 8.7 5.5 7.5 4.8
After 10 seconds, the Datatable will have:
Measure | Robert | Leo | Black | Operah |
Login hour 9.6 5.5 4.3 4.8
When the datatable is created. I want to add dynamic properties to the class "Agent" at "Runtime" each time. It should become:
public class Agent
{
public string Measure { get; set; }
public string Dexter { get; set; }
public string Jordon { get; set; }
public string Ana { get; set; }
public string Polark { get; set; }
}
After it is created, I want to Give the class "Agent" to the MVC View as its model. How I can achieve this.
Note: I am a beginner, so please help me out. I can,t find the solution anywhere.