This is a migrated thread and some comments may be shown as answers.
filter does not work for GridDateTimeColumn?
7 Answers 195 Views
This is a migrated thread and some comments may be shown as answers.
Neeraj
Top achievements
Rank 1
Neeraj asked on 15 Jun 2009, 07:57 PM
I have the below code, data is bound to the grid. All the filters work great except GridDateTimeColumn filters - for some reason the filters do not respect the values that I feed into the text box. eg: if I put in 6/10/2009 and choose equal to - I get no rows. Can Someone please tell me why ? I used to use GridBoundColumn for the date , the filter seemed to work but the problem was when users enter 06/10/2009 , it would not convert it back to 6/10/2009. For this reason I changed it to GridDateTimeColumn and now the filters do not work at all. My version of the controls is 2008.3.1314.35.

  <telerik:RadGrid ID="gridInvoices" DataSourceID="odsInvoices" AllowSorting="true" 
        AllowPaging="true" AllowFilteringByColumn="true" AutoGenerateColumns="false" 
        runat="server" EnableLinqExpressions="false" Skin="Office2007" PageSize="15"   
         OnItemDataBound="gridInvoices_ItemDataBound"  OnInit="gridInvoices_Init" 
         AllowAutomaticDeletes="true" >  
        <PagerStyle Mode="Slider"    />  
 
        <MasterTableView DataKeyNames="TRX_NUMBER" ClientDataKeyNames="TRX_NUMBER" CommandItemDisplay="Top">  
            <Columns>  
                    <telerik:GridHyperLinkColumn  HeaderStyle-Width="30px"  NavigateUrl="NonContract.aspx"  UniqueName="Edit" 
                    Text="Edit">  
                      
                    <FilterTemplate>  
                    <asp:LinkButton ID="btnShowAll" runat="server" OnClick="btnShowAll_Click" Text="Clear Filters"></asp:LinkButton>  
                      
                    </FilterTemplate>  
                      
                    </telerik:GridHyperLinkColumn>  
 
                <telerik:GridHyperLinkColumn AllowFiltering="false" ShowFilterIcon="false" HeaderStyle-Width="30px" 
                    NavigateUrl="NonContract.aspx" UniqueName="Copy" HeaderText="" Text="Copy">  
                </telerik:GridHyperLinkColumn>  
                  
                <telerik:GridNumericColumn HeaderStyle-Width="50px" FilterControlWidth="50px" HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="right"  DataField="INVOICE_AMOUNT" DataFormatString="{0:c}" HeaderText="Amount" 
               
                <telerik:GridDateTimeColumn HeaderStyle-Width="60px" FilterControlWidth="60px" HeaderStyle-HorizontalAlign="center" DataField="CREATION_DATE" DataFormatString="{0:d}" 
                    CurrentFilterFunction="EqualTo"  ShowFilterIcon="true" HeaderText="Creation Date"  DataType="System.DateTime" PickerType="None" HtmlEncode="false"      />  
       
              </Columns>  
        </MasterTableView>  
        <PagerStyle AlwaysVisible="true" />  
        <ClientSettings>  
            <ClientEvents OnFilterMenuShowing="filterMenushowing" />  
        </ClientSettings>  
    </telerik:RadGrid>  
   

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 16 Jun 2009, 07:50 AM
Hi Neeraj,

Filter for GridDateTimeColumn should work with the latest internal build of RadGrid control. For a live example, check out this online demo:
Basic Filtering

If everything works for you in that demo, you should be able to imitate the settings in it to get your code working.

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Neeraj
Top achievements
Rank 1
answered on 16 Jun 2009, 10:06 AM
I did check that example, one question is I am using Oracle - are you guys aware of any such issue in the  radgrid 2008.3.1314.35 version ? If so do you suggest me to upgrade my telerik controls ?

thanks.
0
Pavlina
Telerik team
answered on 16 Jun 2009, 03:33 PM
Hi Neeraj,

Version 2008.3.1314 of RadGrid does have this filtering issue which has already been fixed. Therefore I suggest you download the fix under latest builds.

I hope this helps.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Neeraj
Top achievements
Rank 1
answered on 16 Jun 2009, 03:35 PM
Actually I had to change my package, I was using to_char on a date which returns a string, I used trunc on my date field and it works like a charm.
0
Pavlina
Telerik team
answered on 17 Jun 2009, 03:28 PM
Hello Neeraj,

I am happy to hear that the provided solution helped you to solve the problem.
Please do not hesitate to contact us if any questions or problems arise.

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kaushal
Top achievements
Rank 1
answered on 16 Sep 2014, 07:42 AM
                                    <telerik:GridDateTimeColumn DataField="RegisterOn" HeaderText="Register Date" FilterControlWidth="110px"
                                        SortExpression="RegisterOn" PickerType="DatePicker" EnableTimeIndependentFiltering="true"
                                        DataFormatString="{0:dd/MM/yyyy}">
                                    </telerik:GridDateTimeColumn>

I have taken GridDateTimeColumn but EqualTo filter not working

instead
<telerik:GridBoundColumn DataField="RegisterOn" HeaderText="Register Date" SortExpression="RegisterOn" FilterControlWidth="40px" ItemStyle-Font-Size="13px"
                                        UniqueName="RegisterOn">
                                    </telerik:GridBoundColumn>
in this scenario EqualTo filter working

bit I want in GridDateTimeColumn
0
Pavlina
Telerik team
answered on 16 Sep 2014, 01:56 PM
Hi,

EqualTo filtering of GridDateTimeColumn is not working because the DataFormatString in your case is Different from mm/dd/yyyy. However, in order to set the date time format for a filtering control you could use the FilterDateFormat property of the GridDateTimeColumn as shown below:
<telerik:GridDateTimeColumn DataField="RegisterOn" FilterDateFormat="{0:dd/MM/yyyy}" HeaderText="Register Date" FilterControlWidth="110px"
                        SortExpression="RegisterOn" PickerType="DatePicker" EnableTimeIndependentFiltering="true"
                        DataFormatString="{0:dd/MM/yyyy}">
                    </telerik:GridDateTimeColumn>

Additionally, you can also examine the article below:
http://www.telerik.com/help/aspnet-ajax/grid-filtering-for-griddatetimecolumn-with-dataformatstring.html

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Neeraj
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Neeraj
Top achievements
Rank 1
Kaushal
Top achievements
Rank 1
Share this question
or