This is a migrated thread and some comments may be shown as answers.
DataFormatString doesn't seem to work
1 Answer 18 Views
This is a migrated thread and some comments may be shown as answers.
StuartLittle
Top achievements
Rank 1
StuartLittle asked on 22 Jun 2018, 02:40 PM

I am using the latest Telerik.

My RadGrid has a date column and I am trying to format it but it doesn't work.

<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="true" OnInit="RadGrid1_Init" 
                                PageSize="15"   AllowFilteringByColumn="true"   OnNeedDataSource="RadGrid1_NeedDataSource" OnPreRender="RadGrid1_PreRender" Font-Size="Small">
                
                <MasterTableView>
                    <Columns>
                        <telerik:GridDateTimeColumn DataField="BillDate" UniqueName="BillDateColumn1" DataFormatString="{0:dd/MM/yyyy}"  HeaderText="Bill Date1" />
                        <telerik:GridBoundColumn DataType="System.DateTime" DataField="BillDate" UniqueName="BillDateColumn2" DataFormatString="{0:dd/MM/yyyy}"  HeaderText="Bill Date2" /> 
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

 

In both columns, I get format like 4/30/2017 12:00:00 AM instead of just 4/30/2017.

Is there anything I am missing here?

1 Answer, 1 is accepted

Sort by
0
StuartLittle
Top achievements
Rank 1
answered on 22 Jun 2018, 06:39 PM

Please delete the question.

By mistake, I had set the datatype of date as string in the class definition.

Tags
Grid
Asked by
StuartLittle
Top achievements
Rank 1
Answers by
StuartLittle
Top achievements
Rank 1
Share this question
or