HA
haneefm
Syncfusion Team
November 14, 2007 04:07 PM UTC
Hi Kolauy,
One you can handle the QueryCellFormattedText event handler of the Grid to format the several TimeSpan cell as desired. Please try code below.
bool IsTimeSpanTextWithGeneralFormat = true;
void Model_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
{
if (e.Style.CellValueType == typeof(TimeSpan))
{
TimeSpan tsp;
if (TimeSpan.TryParse(e.Value.ToString(), out tsp))
{
if( IsTextWithTimeSpanGeneralFormat )
e.Text = "TimeSpan" + e.Value ; //your custom formatted text here
else
{
string DisplayText = string.Format("{0}days{1}hour{2}minutes", tsp.Days, tsp.Hours, tsp.Minutes);
e.Text = DisplayText;
}
e.Handled = true;
}
}
}
Best regards,
Haneef