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

Gird not filtering as expected

2 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 09 Mar 2016, 09:03 AM

I am filling my radgrid from code behind using a iquerable but for some reason the filtering is not working at all even when i click the action button nothing happens am i missing a step?.

 

public IQueryable<Appointment> getAllApointments()
{
  var _appointments = apertureNetEntities.Appointments.Where(f => f.isDeleted == false ).OrderByDescending(o => o.authCreatedDate).ToList();
   return _appointments.AsQueryable();
}

 

protected void Page_Load(object sender, EventArgs e)
{
   rgAppointments.DataSource = _dal.getAllApointments();
   rgAppointments.DataBind();
 
 }

This is really bugging me as I have to apply a softdelete check on my datasource, i cant really use entity datasource.

2 Answers, 1 is accepted

Sort by
0
Philip
Top achievements
Rank 1
answered on 09 Mar 2016, 09:06 AM

Sorry i forgot to include my radgrid code here it is

                                                 <telerik:RadGrid ID="rgAppointments"   MasterTableView-CommandItemDisplay="Top" MasterTableView-CommandItemSettings-AddNewRecordText="Add New Appointment" runat="server" AllowPaging="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" GroupPanelPosition="Top" OnItemCommand="rgAppointments_ItemCommand" AllowFilteringByColumn="True" AllowSorting="True">
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                                    <MasterTableView   AutoGenerateColumns="False" DataKeyNames="ID" >
<CommandItemSettings AddNewRecordText="Add New Appointment"></CommandItemSettings>
                                        <Columns>
                                                 <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter ID column" HeaderText="ID" SortExpression="ID" UniqueName="ID" AllowFiltering="False">
                                            </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="TimeCode" FilterControlAltText="Filter TimeCode column" HeaderText="TimeCode" SortExpression="TimeCode" UniqueName="TimeCode">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="CustomName" FilterControlAltText="Filter CustomName column" HeaderText="Customer Name" SortExpression="CustomName" UniqueName="CustomName">
                                            </telerik:GridBoundColumn>
                                             <telerik:GridBoundColumn DataField="Subject" FilterControlAltText="Filter Subject column" HeaderText="Subject" SortExpression="Subject" UniqueName="Subject" AllowFiltering="False">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Start" DataType="System.DateTime" FilterControlAltText="Filter Start column" HeaderText="Start" SortExpression="Start" UniqueName="Start">
                                            </telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="End" DataType="System.DateTime" FilterControlAltText="Filter End column" HeaderText="End" SortExpression="End" UniqueName="End">
                                            </telerik:GridBoundColumn>
                                              <telerik:GridBoundColumn DataField="emailAddress" DataType="System.String" FilterControlAltText="Filter emailAddress column" HeaderText="Email" SortExpression="emailAddress" UniqueName="emailAddress" AllowFiltering="False">
                                            </telerik:GridBoundColumn>
 
                                             <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Description" SortExpression="Description" UniqueName="Description" AllowFiltering="False">
                                            </telerik:GridBoundColumn>
                                           
                                           
                                             <telerik:GridBoundColumn DataField="preferedContactNumber" FilterControlAltText="Filter preferedContactNumber column" HeaderText="Pref Contact Number" SortExpression="preferedContactNumber" UniqueName="preferedContactNumber" AllowFiltering="False">
                                            </telerik:GridBoundColumn>
                                            
                                              
                                       </Columns>
                                    </MasterTableView>
                            </telerik:RadGrid>
                            
                             
                            <!-- END Example Content -->
                        </div>
                        <!-- END Example Block -->
                    </div>
                    <!-- END Page Content -->
    
</asp:Content>

0
Viktor Tachev
Telerik team
answered on 10 Mar 2016, 01:06 PM
Hello Philip,

I have replied to the support ticket you have submitted and suggest we continue the conversation there. In case someone is observing similar behavior I will post the reply from the ticket here as well.

I have examined the provided code and noticed that you are using DataBind() for RadGrid. Note that this method is intended to be used only with simple data binding. As the name implies this type of binding is suitable only for the most simple scenarios where operations like filtering, sorting, paging, etc. will not be used.

In your scenario it is recommended to use advanced data binding. You can either bind the RadGrid to a declarative DataSource control (e.g. EntityDataSource) or handle the NeedDataSource event and provide the data there. Please remove all calls to DataBind() and check out the following resources that describe both approaches for advanced data-bindng in more detail.




Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Answers by
Philip
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or