I am using Telerik RadGrid in my project.
I have a "Datetime" column (CreatedDate) in RadGrid, in which records are shown from SQL Database using DataSource.
<
asp:ObjectDataSource
ID
=
"odsDocumentHistoryAdmin"
runat
=
"server"
SelectMethod
=
"Query"
TypeName
=
"atQuest.Projects.ABC.IPRRequest"
SortParameterName
=
"orderBy"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"ddlStatus"
Name
=
"status"
PropertyName
=
"SelectedValue"
Type
=
"Int32"
ConvertEmptyStringToNull
=
"true"
/>
<
asp:ControlParameter
ControlID
=
"txtSearch"
Name
=
"searchValue"
PropertyName
=
"Text"
Type
=
"String"
ConvertEmptyStringToNull
=
"true"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
telerik:RadGrid
ID
=
"qgDocumentHistoryAdmin"
runat
=
"server"
DataSourceID
=
"odsDocumentHistoryAdmin"
AllowPaging
=
"True"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"True"
ShowGroupPanel
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
Width
=
"100%"
Skin
=
"Outlook"
>
<
ClientSettings
AllowDragToGroup
=
"True"
/>
<
GroupingSettings
CaseSensitive
=
"false"
></
GroupingSettings
>
<
MasterTableView
AllowFilteringByColumn
=
"true"
AllowMultiColumnSorting
=
"false"
AutoGenerateColumns
=
"false"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"RequisitionNo"
EnableGroupsExpandAll
=
"true"
GroupLoadMode
=
"Client"
PageSize
=
"50"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowExportToExcelButton
=
"true"
/>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"RequisitionNo"
SortOrder
=
"Descending"
/>
</
SortExpressions
>
<
PagerStyle
AlwaysVisible
=
"True"
PageSizeControlType
=
"RadComboBox"
Position
=
"Bottom"
PageSizes
=
"50,100,150,200"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"CreatedDate"
HeaderText
=
"Submit Date"
SortExpression
=
"CreatedDate"
UniqueName
=
"CreatedDate"
FilterDelay
=
"2000"
ShowFilterIcon
=
"false"
DataFormatString
=
"{0: dd/MM/yyyy hh:mm:ss tt}"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
ExportSettings
SuppressColumnDataFormatStrings
=
"True"
IgnorePaging
=
"True"
ExportOnlyData
=
"True"
Excel-Format
=
"ExcelML"
OpenInNewWindow
=
"True"
FileName
=
"eAPDocHistory"
Excel-FileExtension
=
"xls"
>
</
ExportSettings
>
</
telerik:RadGrid
>
Few records in Database "DateTime" column have NULL value and few records have proper date and time.
When I run my Web Page, everytime I get "01/01/0001 12:00:00 AM" datetime format in RadGrid "DateTime" column, for all the records.
Despite of proper records in Database, output is not as per expectation.
I am new to ASP.NET as well as Telerik Controls. Please reply what I am missing in my code.
Thanks in advance.