4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 10 Nov 2009, 10:06 AM
Hi Jaromin,
I tried setting the DateFormatString from code in ColumnCreated event and it is working fine for me. Give a try with this approach.
CS:
Regards,
Shinu.
I tried setting the DateFormatString from code in ColumnCreated event and it is working fine for me. Give a try with this approach.
CS:
| protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
| { |
| if (e.Column is GridBoundColumn && e.Column.UniqueName == "StartDate") |
| { |
| GridBoundColumn column = (GridBoundColumn)e.Column; |
| column.DataFormatString = "{0:d}"; |
| } |
| } |
Regards,
Shinu.
0
wnl
Top achievements
Rank 1
answered on 10 Nov 2009, 11:32 AM
Ok, but is that any way to make this without specifying"Column.UniqueName"?
0
Accepted
Amit
Top achievements
Rank 1
answered on 19 Mar 2012, 08:27 AM
Try This.... You will get what you need
If e.Column.DataTypeName = "System.DateTime" Then Dim column As GridBoundColumn = DirectCast(e.Column, GridBoundColumn) column.DataFormatString = "{0:m}"End If0
Amit
Top achievements
Rank 1
answered on 19 Mar 2012, 08:28 AM
Try This.... You will get what you need
If e.Column.DataTypeName = "System.DateTime" Then Dim column As GridBoundColumn = DirectCast(e.Column, GridBoundColumn) column.DataFormatString = "{0:m}"End If