Hello,
I have a problem with CellFormatting handle of GridView.
I have a column that contains 8-char strings that rappresents a date in the format yyyyMMdd.
In order to make more confortable the visualization of the date to the user, I change the format in dd/MM/yyyy using CellFormatting.
The problem I got in runtime is it seems the GridView apply this cell formatting only for the cells that are currently displayed to the user.
The other cells that are not visible but could be reach using the vertical scrollbar mantains the old format yyyyMMdd.
As a terrible consequence of this behavior is when I group by the date column, I have some rows with the original format yyyyMMdd, and other rows with the new format dd/MM/yyyy. Although they rappresents the same date (such as 20111012 and 12/10/2011) the grouping engine recognize them as different values and it groups the rows in two different groups.
So I need a suggestion to avoid this problem, what should be the correct method to handle to makes this cell formatting in order to be sure it is done to all the rows.
Another conseguence of the problem is when I export to excel or cvs, the behaviour is pretty like the same: I got some rows with the new format dd/MM/yyyy (exacly the rows that are currently displayed) and the other are saved with the old format (yyyyMMdd).
I suppose this is a sort of mechanism where the cell formatting is applied in runtime only to the displayed cells, probably for speed optimization purpose. In this case for me the cell formatting method is totally unuseless, so I need to know the right way to do the job.
Thanks for any aid
Alcide
I have a problem with CellFormatting handle of GridView.
I have a column that contains 8-char strings that rappresents a date in the format yyyyMMdd.
In order to make more confortable the visualization of the date to the user, I change the format in dd/MM/yyyy using CellFormatting.
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
base.OnCellFormatting(sender, e);
GridCellElement ce = e.CellElement;
ce.Value = ChangeDateFormat(ce.Value);
}
The problem I got in runtime is it seems the GridView apply this cell formatting only for the cells that are currently displayed to the user.
The other cells that are not visible but could be reach using the vertical scrollbar mantains the old format yyyyMMdd.
As a terrible consequence of this behavior is when I group by the date column, I have some rows with the original format yyyyMMdd, and other rows with the new format dd/MM/yyyy. Although they rappresents the same date (such as 20111012 and 12/10/2011) the grouping engine recognize them as different values and it groups the rows in two different groups.
So I need a suggestion to avoid this problem, what should be the correct method to handle to makes this cell formatting in order to be sure it is done to all the rows.
Another conseguence of the problem is when I export to excel or cvs, the behaviour is pretty like the same: I got some rows with the new format dd/MM/yyyy (exacly the rows that are currently displayed) and the other are saved with the old format (yyyyMMdd).
I suppose this is a sort of mechanism where the cell formatting is applied in runtime only to the displayed cells, probably for speed optimization purpose. In this case for me the cell formatting method is totally unuseless, so I need to know the right way to do the job.
Thanks for any aid
Alcide