I have a DataSource built that has a date (numeric field), but it is in yyMMdd format and I need it to be in MMddyy format in the ultrawingrid.
Is there a way in ultrawingrid to convert the format before populating the cell?
Is the data source's date a DateTime object, or is it simply a numeric field? If it's already a DateTime, then you could just set the Format property on the column; this property takes the same format string that the .NET ToString method takes on object. If it's a numeric type and you need it parsed as a DateTime, then your best bet is to use either a DataFilter, or create an unbound column for the DateTime object and parse the numeric object into a DateTime during the InitializeRow event.
-Matt
Matt,
Thanks for the tip. I did use an unbound column and parsed the data out. It works great. I am populating it during the InitializeRow event.
But I am wondering, when is the InitializeRow event supposed to fire? I does fire during the grid initialize to populate the unbound column, but it is also firing when I am updating cells in my grid. Is it supposed to fire then also?
-duane
Hi Duane,
InitializeRow is specifically designed for situations like this. It will fire any time a value in the row changes. So it's ideal for populating unbound columns or applying an appearance to a cell or a row based on a value in the row.
If you want to trap for when it fires the first time, you can use the e.ReInitialize parameter to tell.