9 Answers, 1 is accepted
0
Hello andi,
Thank you for this question.
You can customize the cell's text formatting by using the DataTextFormatString property of the GridViewDataColumn.
Refer to the sample code below:
You should explicitly set the column type to be DateTime. Another possibility is manually adding a GridViewDateTimeColumn to the Columns collection.
I hope this helps. Do not hesitate to contact me, if you need further assistance.
Kind regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for this question.
You can customize the cell's text formatting by using the DataTextFormatString property of the GridViewDataColumn.
Refer to the sample code below:
GridViewDateTimeColumn column = (GridViewDateTimeColumn)this.radGridView1.Columns["Date"]; |
column.DataTextFormatString = "{0:dd.mm.yy}"; |
column.DataTextFormatString = "{0:hh.mm}"; |
You should explicitly set the column type to be DateTime. Another possibility is manually adding a GridViewDateTimeColumn to the Columns collection.
I hope this helps. Do not hesitate to contact me, if you need further assistance.
Kind regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

andi
Top achievements
Rank 1
answered on 28 Mar 2008, 02:31 PM
hello and thank you for the answer,
could you please post the codepart in your reply as visual basic code?
thank, andi
could you please post the codepart in your reply as visual basic code?
thank, andi
0
Hi andi,
Here is the code in Visual Basic:
Please, let me know if I can assist you further.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is the code in Visual Basic:
Dim column As GridViewDateTimeColumn = DirectCast(Me.radGridView1.Columns("Date"), GridViewDateTimeColumn) |
column.DataTextFormatString = "{0:dd.mm.yy}" |
column.DataTextFormatString = "{0:hh.mm}" |
Please, let me know if I can assist you further.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

andi
Top achievements
Rank 1
answered on 28 Mar 2008, 05:57 PM
thank you! now it works...
but there`s something strange with it: "{0:dd.mm.yy}" displays "00" for the month column, "{0:dd.MM.yy}" displays the correct month...
is this a bug?
andi
but there`s something strange with it: "{0:dd.mm.yy}" displays "00" for the month column, "{0:dd.MM.yy}" displays the correct month...
is this a bug?
andi
0

Pedro Valero Matas
Top achievements
Rank 1
answered on 29 Mar 2008, 07:04 AM
'mm' is the string format for minutes (hh:mm:ss) and 'MM' for month
0
Hi andi,
Pedro is correct. Thank you for this suggestion.
You can find more about the date and time formatting on the MSDN site. Please follow the link below:
http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx
Please contact me, if you have other questions.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Pedro is correct. Thank you for this suggestion.
You can find more about the date and time formatting on the MSDN site. Please follow the link below:
http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx
Please contact me, if you have other questions.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

buda56
Top achievements
Rank 1
answered on 05 Jun 2008, 03:56 AM
Hi,
The properties described are now obsolete when using 2008 Q1 you need to use the following:
The properties described are now obsolete when using 2008 Q1 you need to use the following:
private void gvConnections_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
GridViewDateTimeColumn column = (GridViewDateTimeColumn)this.gvConnections.Columns["IDate"];
column.FormatString =
"{0:dd/MM/yyyy}";
}
Regards..
Peter
0

macmariman
Top achievements
Rank 2
answered on 31 Aug 2009, 08:56 PM
I've tried the solution proposed by Buda56 but it is fires an stack overflow on the event. I'm using 2008 Q1 and I couldn't set properly a GridViewDateTimeColumn with this format "{0:dd/MM/yyyy}". Any suggestion?
Thanks in advance, regards
Martin
0
Hello macmariman,
The described issue is addressed in our latest release - Q2 2009 SP1. I recommend that you try this version. It contains many improvements and exiting new features. We will be glad to help you with the transition process.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
The described issue is addressed in our latest release - Q2 2009 SP1. I recommend that you try this version. It contains many improvements and exiting new features. We will be glad to help you with the transition process.
Sincerely yours,
Jack
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.