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

Filtering with RadDatePicker inside radgrid

3 Answers 252 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Leadeng Leadeng
Top achievements
Rank 1
Leadeng Leadeng asked on 14 Nov 2009, 11:18 PM
Dear Telerik
                       My Requirement is to do filtering based on  date.I am using raddatepicker inside radgrid.Please find below the radgrid aspx code.Please let me know how to filter based on date or time in codebehind file using c#.I need it urgently.Appreciate your quick response.


 <telerik:RadGrid ID="gvEventHistory" skin ="Default" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"
     AllowFilteringByColumn="true" OnItemDataBound="gvEventHistory_ItemDataBound" OnItemCreated="gvEventHistory_ItemCreated" >
    <MasterTableView>
    <RowIndicatorColumn>
    <HeaderStyle Width="2px" />
    <ItemStyle Width ="10px" />
    </RowIndicatorColumn>
   <Columns>
          
    <telerik:GridBoundColumn DataField="START_TIME" HeaderText="Start date" AllowFiltering="true"
    CurrentFilterFunction="EqualTo" ShowFilterIcon="false" DataFormatString="{0:d}">
    <FilterTemplate>
    <telerik:RadDatePicker ID="rdStartDate" runat="server" ClientEvents-OnDateSelected="DateSelected">
    </telerik:RadDatePicker>
    </FilterTemplate>
    </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="END_TIME" AllowFiltering="true" HeaderText="Start time" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" DataFormatString="{0:T}">
    <FilterTemplate>
    <telerik:RadTimePicker ID="rdStartTime" runat="server"></telerik:RadTimePicker>
    </FilterTemplate>
    </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings Selecting-AllowRowSelect="true">
        <ClientEvents/>
        </ClientSettings>
    </telerik:RadGrid>
  

Thanks
Sri

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 16 Nov 2009, 10:45 AM
Hello Leadeng,

I recommend you visit the following online example and see whether this approach suits your scenario:
Filter Templates

I hope this helps.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Leadeng Leadeng
Top achievements
Rank 1
answered on 16 Nov 2009, 02:15 PM
Dear Pavlina
                     I did see that example and it was not working for me.My code has the raddatepicker control inside the filtertemplate
and I have ShowFilterIcon="false" and I am binding the data using databind() method.How can I filter the data if user selects the date from raddatepicker.so that the radgrid is refreshed and data is displayed based on date selected.Please let me how to solve this problem.Appreciate for your quick response.


<telerik:GridBoundColumn DataField="START_TIME" HeaderText="Start date" AllowFiltering="true"
    CurrentFilterFunction="EqualTo" ShowFilterIcon="false" DataFormatString="{0:d}">
    <FilterTemplate>
    <telerik:RadDatePicker ID="rdStartDate" runat="server" ClientEvents-OnDateSelected="DateSelected">
    </telerik:RadDatePicker>
    </FilterTemplate>
    </telerik:GridBoundColumn>


Thanks and Regards
Sri
0
Pavlina
Telerik team
answered on 19 Nov 2009, 12:53 PM
Hello Leadeng,

The filtering feature of RadGrid is not supported with simple binding and DataBind() calls. This is outlined in the Description section of the following online demo of the product:
http://demos.telerik.com/aspnet-ajax/Grid/Examples/GeneralFeatures/Filtering/DefaultCS.aspx

If you would like to take advantage of this grid feature, please switch to advanced binding using NeedDataSource event handling or a data source control (as shown in the example linked above).

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Leadeng Leadeng
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Leadeng Leadeng
Top achievements
Rank 1
Share this question
or