I'm using UltraGrid (v14.2.20142.2092), and binding to a collection of objects that have datetime properties. These are not being displayed on the grid, but the other non datetime properties are. How do I bind DateTime properties to an Ultragrid and have it displayed in a format that I specify.
Example:
class MyObject {
int Key {get; set;}
DateTime Date {get; set;}
}
var listToBind = new List<MyObject>();
listToBind.Add(...)
this.UltraGrid1.SetDataBinding(listToBind, string.Empty);
NOTE***
Please provide example code to achieve what I am trying to do.
Hi Plamena Miteva,
The problem was not the access modifier. I just had forgotten to put the "public" before the properties...
Although I found my problem. I had a subscription to the "InitializeRow" event which had a code to "hide" the DateTime values when they're equal to DateTime.MinValue / DateTime.MaxValue by setting the cell font forecolor to SystemColor.Window (invisible to the user).
So there was nothing wrong with the UltraGrid control.
Thanks for your support!
Hello HRS,
I believe the reason for that issue is the inaccessibility of the properties in the MyObject class. As they do not have any access modifiers specified they are set to the default accessibility of class members, which in C# is private. This makes them inaccessible due to the protection level.
Please find attached a simple sample project that binds an Ultra Grid to a list of MyObject objects as you requested.
If this does not help, could you please attach a sample project in order to provide me with more information needed to investigate this issue further.