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

Sortting with Date type in telerik:GridTemplateColumn

7 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
nguyen
Top achievements
Rank 1
nguyen asked on 26 Aug 2011, 05:16 AM
Hello,

 I've Sortting  with Date type but use telerik:GridTemplateColumn in radGrid. But it always sort like string type, note date type. My code is:

    <telerik:GridTemplateColumn HeaderText="Date" ItemStyle-Width="100"
                            SortExpression="Date" UniqueName="Date" DataField="Date"
                            CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true"
                            FilterControlWidth="100%">
                            <HeaderStyle Font-Bold="true" />
                            <ItemStyle Width="70" />
                            <ItemTemplate>
                                <%# (ConvertHelper.ToDateTime(Eval("Date"))).ToString("dd.MM.yyyy")%>
                            </ItemTemplate>
                             <EditItemTemplate>
                                <telerik:RadDatePicker ID="rdDate" runat="server" Culture="German (Switzerland)" Width="100"
                                    Skin="abc" EnableEmbeddedSkins="false" SelectedDate='<%# (ConvertHelper.ToDateTime(Eval("Date"))) %>'>
                                    <DateInput Width="70" runat="server">
                                    </DateInput>
                                </telerik:RadDatePicker>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

Please help me sortting in this case. Use <telerik:GridTemplateColumn>.....</telerik:GridTemplateColumn and Sortting by Date Type, not string type.

Thanks, 

Nguyen Quang Hung

7 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Aug 2011, 09:36 AM
Hello,

<telerik:GridTemplateColumn DataType="System.DateTime">


Thanks,
Jayesh Goyani
0
nguyen
Top achievements
Rank 1
answered on 26 Aug 2011, 09:45 AM

Thank Jayesh Goyani!

But when  I  add property DataType="System.DateTime". It still error!
maybe because with format ToString("dd.MM.yyyy") in: 
                    ...........
                           <ItemTemplate>
                               <%# (ConvertHelper.ToDateTime(Eval("Date"))).ToString("dd.MM.yyyy")%>
                            </ItemTemplate>
                    ..........
and rad control sortting by string type. I don't know how to fix it.

 
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Aug 2011, 10:05 AM
Hello,

Eval("Date")

This Date is in Date format or String format ?

Thanks,
Jayesh Goyani
0
nguyen
Top achievements
Rank 1
answered on 26 Aug 2011, 10:52 AM
thank Jayesh Goyan a lot, 

my problem is fixed.
0
nguyen
Top achievements
Rank 1
answered on 31 Aug 2011, 11:29 AM
Hello,
 I've another problem:  when i add <telerik:GridTemplateColumn DataType="System.DateTime">. Sortting is ok but but the filter function error. 
i think Filterring by data type "string"
 



  
0
Jayesh Goyani
Top achievements
Rank 2
answered on 31 Aug 2011, 12:22 PM
Hello,

please check below link for handle this thing manually.
http://www.telerik.com/help/aspnet/grid/grdfilteringfordatetimecolumnwithdataformatstring.html

Thanks,
Jayesh Goyani
0
Jaya
Top achievements
Rank 1
answered on 17 Apr 2015, 09:29 AM

Hello

Jayesh

 

can you solve this url

 

http://www.telerik.com/forums/how-to-changes-telerik-grid-running-total-footer-template

Tags
General Discussions
Asked by
nguyen
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
nguyen
Top achievements
Rank 1
Jaya
Top achievements
Rank 1
Share this question
or