I am using RadGrid version 2009.3.1208.35. All code is below.
When I set the Date column as DataType="System.DateTime" it still does not seem to sort correctly. If i set the Column type to DateTime, ie "dt.Columns.Add("Date", typeof(DateTime));" it works. Is there any way to have correct sorting without having to do this?
When I set the Date column as DataType="System.DateTime" it still does not seem to sort correctly. If i set the Column type to DateTime, ie "dt.Columns.Add("Date", typeof(DateTime));" it works. Is there any way to have correct sorting without having to do this?
protected void gv_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
DataTable dt = new DataTable(); |
dt.Columns.Add("Date"); |
dt.Columns.Add("Double"); |
dt.Rows.Add(new object[] {"14/08/2009","1.1" }); |
dt.Rows.Add(new object[] { "20/08/2009", "10.1" }); |
dt.Rows.Add(new object[] { "10/09/2009", "2.1" }); |
dt.Rows.Add(new object[] { "25/09/2008", "2.1" }); |
dt.Rows.Add(new object[] { "25/11/2009", "2.1" }); |
dt.Rows.Add(new object[] { "1/1/2009", "2.1" }); |
rg.DataSource = dt; |
} |
<telerik:RadGrid ID="rg" runat="server" AutoGenerateColumns="false" OnNeedDataSource="gv_NeedDataSource" |
AllowSorting="true"> |
<MasterTableView> |
<Columns> |
<telerik:GridBoundColumn DataType="System.DateTime" HeaderText="Date" DataField="Date" |
UniqueName="Date" DataFormatString="{0:MM/yyyy}"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataType="System.Double" HeaderText="Double" DataField="Double" |
ItemStyle-HorizontalAlign="Right"> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |