I have to format columns in my RadGrids based on user-selected formatting, so I can't always format columns in the aspx page, I have to do it in the code behind.
With that in mind, I have a couple of helper functions which I use to format columns in a RadGrid
However, I'm not sure what the best way would be to format columns in a DetailTable. Could someone let me know if this is the best way of achieving this?
Public Shared Sub RadGridColumnFormatDate(ByRef RadGrid1 As RadGrid, ByVal ColumnName As String)
Dim col As GridBoundColumn
For Each detailtable In RadGrid1.MasterTableView.DetailTables
Try
col = detailtable.Columns.FindByUniqueName(ColumnName)
col.DataFormatString = "{0:" & GetDateFormatStr & "}"
Catch
End Try
Next
Try
col = RadGrid1.Columns.FindByUniqueName(ColumnName)
col.DataFormatString = "{0:" & GetDateFormatStr & "}"
Catch
End Try
End Sub
With that in mind, I have a couple of helper functions which I use to format columns in a RadGrid
However, I'm not sure what the best way would be to format columns in a DetailTable. Could someone let me know if this is the best way of achieving this?
Public Shared Sub RadGridColumnFormatDate(ByRef RadGrid1 As RadGrid, ByVal ColumnName As String)
Dim col As GridBoundColumn
For Each detailtable In RadGrid1.MasterTableView.DetailTables
Try
col = detailtable.Columns.FindByUniqueName(ColumnName)
col.DataFormatString = "{0:" & GetDateFormatStr & "}"
Catch
End Try
Next
Try
col = RadGrid1.Columns.FindByUniqueName(ColumnName)
col.DataFormatString = "{0:" & GetDateFormatStr & "}"
Catch
End Try
End Sub