Hi,
We use in the Grid different column with the date format : dd-MM-yyyy (01-02-2009).
The standard filtering don't work.
I read different post and the documentation ( with many broken links) about this problem but i don't found any solution.
Do you have a nice sample to implement the filter with different format date who's work.
I use for the date only the filter Equal To.
Bellow my code:
and the filter code :
Thanks for your help.
Edwin.
We use in the Grid different column with the date format : dd-MM-yyyy (01-02-2009).
The standard filtering don't work.
I read different post and the documentation ( with many broken links) about this problem but i don't found any solution.
Do you have a nice sample to implement the filter with different format date who's work.
I use for the date only the filter Equal To.
Bellow my code:
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="Office2007" |
GridLines="None" PageSize="13" Height="455px" OnNeedDataSource="RadGrid1_OnNeedDataSource" |
AutoGenerateColumns="false" OnInit="RadGrid_Init" AllowSorting="true" AllowPaging="true" EnableViewState="false" |
PagerStyle-AlwaysVisible="true" AllowFilteringByColumn="true" FilterItemStyle-HorizontalAlign="Left"> |
<MasterTableView DataKeyNames="ReactionId" Width="100%" IsFilterItemExpanded="true" AllowFilteringByColumn="true"> |
<Columns> |
<telerik:GridBoundColumn DataField="ReactionId" HeaderText="Id" AllowFiltering="false" UniqueName="ReactionId" SortExpression="ReactionId"> |
<HeaderStyle HorizontalAlign="Left" Width="20" /> |
<ItemStyle HorizontalAlign="Left" Width="20" Wrap="false" Height="20px" /> |
</telerik:GridBoundColumn> |
<telerik:GridTemplateColumn UniqueName="VacancyName" DataField="VacancyName" InitializeTemplatesFirst="false" SortExpression="VacancyName" AllowFiltering="true"> |
<HeaderTemplate> |
<asp:LinkButton ID="btnVacancyName" Text="Vacaturetitel" ToolTip="Sorteren per vacaturetitel" CommandName="Sort" CommandArgument="VacancyName" runat="server"></asp:LinkButton> |
</HeaderTemplate> |
<HeaderStyle HorizontalAlign="Left" /> |
<ItemTemplate> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<asp:LinkButton ID="btn_EditReaction" runat="server" CommandArgument='<%#Eval("ReactionId")%>' CssClass="lnk" CommandName="EditReaction" OnClick="Edit_OnClick" CausesValidation="false"><%#Eval("VacancyName")%></asp:LinkButton> |
</telerik:RadCodeBlock> |
</ItemTemplate> |
<ItemStyle Width="100%" HorizontalAlign="left" /> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="StatusName" HeaderText="Status" UniqueName="StatusName" SortExpression="StatusName"> |
<ItemStyle HorizontalAlign="Left" Wrap="false" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="ReactionDate" HeaderText="Reactiedatum" UniqueName="ReactionDate" DataType="System.DateTime" DataFormatString="{0:dd-MM-yyyy}" SortExpression="ReactionDate"> |
<ItemStyle HorizontalAlign="Left" Wrap="false" /> |
</telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
<PagerStyle Mode="NextPrevAndNumeric" NextPageText="Volgende pagina" PrevPageText="Vorige pagina" NextPagesToolTip="Volgende pagina" PrevPagesToolTip="Vorige pagina" PagerTextFormat="Pagina: {4} Pagina {0} tot {3} op {5}" /> |
<GroupingSettings CaseSensitive="false" /> |
<FilterMenu EnableTheming="true" Skin="Office2007"> |
<collapseAnimation Duration="200" Type="OutQuint" /> |
</FilterMenu> |
<ClientSettings AllowDragToGroup="False" EnableRowHoverStyle="true"></ClientSettings> |
</telerik:RadGrid> |
and the filter code :
/// <summary> |
/// reduce menu filter options |
/// </summary> |
/// <param name="sender">object</param> |
/// <param name="e">EventArgs</param> |
/// translation: |
/// NoFilter = Geen filter |
/// Contains = Bevat het woord |
/// Equal to = Gelijk aan |
/// StartsWith = Begint met |
/// EndsWith = Eindigd met |
protected void RadGrid_Init(object sender, EventArgs e) |
{ |
GridFilterMenu menu = RadGrid1.FilterMenu; |
int i = 0; |
while (i < menu.Items.Count) |
{ |
if (menu.Items[i].Text == "NoFilter") |
{ |
menu.Items[i].Text = "Geen filter"; |
i++; |
} |
else if (menu.Items[i].Text == "Contains") |
{ |
menu.Items[i].Text = "Bevat het woord"; |
i++; |
} |
else if (menu.Items[i].Text == "EqualTo") |
{ |
menu.Items[i].Text = "Gelijk aan"; |
i++; |
} |
else if (menu.Items[i].Text == "StartsWith") |
{ |
menu.Items[i].Text = "Begint met"; |
i++; |
} |
else if (menu.Items[i].Text == "EndsWith") |
{ |
menu.Items[i].Text = "Eindigd met"; |
i++; |
} |
else |
{ |
menu.Items.RemoveAt(i); |
} |
} |
} |
Thanks for your help.
Edwin.