This is a migrated thread and some comments may be shown as answers.

[Solved] Datetime odata format

1 Answer 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
OPA
Top achievements
Rank 1
OPA asked on 23 Aug 2013, 03:33 PM
hello 

i have the following grid with client databind odata, it's works fine, but the problem is with the datetime fields i can't display the field correctly, its the code 

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true" AllowSorting="true" ShowGroupPanel="true" PageSize="5" AllowPaging="true">
    <MasterTableView ClientDataKeyNames="IdNavegacionenMenus">
      
        <Columns>
            <telerik:GridBoundColumn DataField="IdNavegacionenMenus" UniqueName="ClId" HeaderText="Id Navegacion" DataType="System.Int64"></telerik:GridBoundColumn>                       
            <telerik:GridBoundColumn DataField="FechaNavegacion" UniqueName="ClHora" HeaderText="Fecha suceso" DataType="System.DateTime" ></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="NombreUsuario" DataType="System.String" UniqueName="Nombre" HeaderText="Nombre"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="OpcionNavegada" DataType="System.String" UniqueName="Opcion" HeaderText="Opcion navegada"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CodigoUsuario" DataType="System.String" UniqueName="Codigo" HeaderText="Codigo"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="MacEntrada" DataType="System.String" UniqueName="Mac" HeaderText="Mac"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
 
    <ClientSettings AllowGroupExpandCollapse="true">
        <DataBinding Location="http://localhost:50155/ODataAuditoria.svc" DataService-Type="OData" ResponseType="JSONP">
            <DataService TableName="NavegacionenMenus" Type="OData" />
        </DataBinding>
    </ClientSettings>
</telerik:RadGrid>

the datetime fields display like "/Date(1377165480000)/"

anybody help me please?

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 28 Aug 2013, 10:13 AM
Hi,

It looks like the object could not be parsed to the appropriate date format and it is displayed unformatted. Nevertheless a possible solution is to manually set a format by setting DataFormatString property. For instance:
<telerik:GridBoundColumn DataField="FechaNavegacion" UniqueName="ClHora" HeaderText="Fecha suceso" DataType="System.DateTime" DataFormatString="{0:D}" >
</telerik:GridBoundColumn>

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
OPA
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or