In a RadGrid, I have a requirement to display running sports time as a text mask of hour:min:sec (00:00:00) but store this in the database as a BigInt of timepan.ticks.
I have the 2 methods to convert from one to another show below.
The application is being converted from Devexpress ASPxGridView to Telerik RadGrid. I show the existing devexpress grid methods used below.
Can someone tell me what RadGrid methods will allow me to have the same functionality to Display 00:00:00 but save ti the database as a BigInt.
Thanks so much for your help.
I have the 2 methods to convert from one to another show below.
The application is being converted from Devexpress ASPxGridView to Telerik RadGrid. I show the existing devexpress grid methods used below.
// Called from Devexpress ASPxGridView1_ParseValue on Insert/Update
private static long LongFromString(Object value)
{
if (value == null || String.IsNullOrEmpty((String)value))
{
return 0;
}
else
{
TimeSpan span = TimeSpan.Parse((String)value);
return span.Ticks;
}
}
Here, one method is for the Grid rows and one is for edit mode.
// Called from Devexpress ASPxGridView1_CellEditorInitialize on Select
// AND Devexpress ASPxGridView1_CustomColumnDisplayText on Select
private static String StringFromBigInt(Object Value)
{
TimeSpan span = new TimeSpan((long)Value);
if (span.Days != 0)
return span.ToString("c");
String str = span.ToString(@"hh\:mm\:ss");
return String.Format("{0}", str);
}
Thanks so much for your help.