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

filtering doesn't work

4 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
golddog
Top achievements
Rank 1
golddog asked on 09 Sep 2008, 02:40 PM
I don't understand why filtering isn't working.  The difference with this grid compared to others I'm familiar with is this was implemented with DetailTables.

The DataSource of the grid is a IQueryable set of objects, so I don't think it's a problem there.

Unlike other grids in our application, when I (for example) filter on colText, my grid is not filtered, I just get back the same results.  It seems like I'm taking the same kinds of steps as other grids, allowing filtering where I want it.

Anything obvious I'm overlooking?

<telerik:RadGrid ID="grdQuestionsUsed" SkinID="MultirowSelect" EnableViewState="true" AllowFilteringByColumn="true" runat="server">
    
<ClientSettings>
        
<ClientEvents OnFilterMenuShowing="QuestionsUsedFilterMenuShowing" />
    
</ClientSettings>

    <MasterTableView 
            HierarchyLoadMode
="ServerBind" DataKeyNames="Id,IsQuestionGroup">

        <NoRecordsTemplate>
            
No Questions are used in this Template
        
</NoRecordsTemplate>

        <Columns>
            
<telerik:GridBoundColumn HeaderText="Question Text" 
                            DataField="Name"  UniqueName="colText" AllowFiltering="true" />
            
<telerik:GridCheckBoxColumn HeaderText="Soft Benefit" 
                            DataField="SoftBenefit" UniqueName="colSoftBenefit" 
                            
AllowFiltering="true" />
            
<telerik:GridEditCommandColumn ButtonType="LinkButton" 
                            
EditText="View/Edit" UniqueName="colEdit" />
            
<telerik:GridTemplateColumn HeaderText="Move Up/Down" 
                            AllowFiltering="false">
    
            <ItemTemplate>
                    
<asp:ImageButton ID="ibOrderUp" ImageUrl="~/images/uparrow.gif" 
                            CommandName="QuestionUp" runat="server" />
                    
<asp:ImageButton ID="ibOrderDown" ImageUrl="~/images/downarrow.gif" 
                            CommandName="QuestionDown" runat="server" />
                
</ItemTemplate>\
           </telerik:GridTemplateColumn>
        
</Columns>

        
<DetailTables>
            
<telerik:GridTableView Width="100%" AllowFilteringByColumn="false" 
                    DataKeyNames="QuestionID">

            <Columns>
                
<telerik:GridBoundColumn HeaderText="Question Text" DataField="Text" />
                
<telerik:GridCheckBoxColumn HeaderText="Soft Benefit" 
                        DataField="SoftBenefit" />
                
<telerik:GridEditCommandColumn ButtonType="LinkButton" 
                        EditText="View/Edit" UniqueName="colEdit" />
                
<telerik:GridTemplateColumn UniqueName="colGroup" AllowFiltering="false">
                    
<ItemTemplate>
                        
<asp:LinkButton ID="lbRemove" CommandName="Remove" 
                            Text="Remove From Group" 
                            OnClientClick="return confirm('Are you sure you want to remove this question from the group?');"
                            
runat="server" />
                        
<asp:ImageButton ID="ibUp" ImageUrl="~/images/uparrow.gif" 
                            CommandName="Up" runat="server" />
                        
<asp:ImageButton ID="ibDown" ImageUrl="~/images/downarrow.gif" 
                            CommandName="Down" runat="server" />
                    
</ItemTemplate>
                
</telerik:GridTemplateColumn>
            
</Columns>
            
</telerik:GridTableView>
        
</DetailTables>
    </MasterTableView>
</telerik:RadGrid>

4 Answers, 1 is accepted

Sort by
0
golddog
Top achievements
Rank 1
answered on 09 Sep 2008, 02:50 PM
I stumbled into a thread which had me try "EnableLinqExpressions=false".

Seems like it's working, but I don't really understand why.  Telerik support, can you provide more detail when you have time, please?

Also, is there on-line API documentation that I'm missing?  I was poking around, trying to find a description of this property so I could read up on it, but no dice.
0
Iana Tsolova
Telerik team
answered on 10 Sep 2008, 08:26 AM
Hi golddog,

Possible reason for the filtering not work are:
  • You are using simple data-binding to bind your grid (review this help topic).
  • Your grid is this disabled ViewState (more information is available here).

But as you mentioned that setting EnableLinqExpressions to false helped in your case:
I assume that the DataSource of the grid contains objects with different type, for instance Object1, Object2 etc.

Let me know if your case is one of the above or we should look for another source of the issue.

All the best,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
golddog
Top achievements
Rank 1
answered on 10 Sep 2008, 02:17 PM
Thanks for the links, Iana.

No, I don't think so.  We're using the NeedDataSource event to set our grid's data source, and as you can see from the markup, view state is enabled.

But, that's not really what I'm on about.  More looking for information on the difference between setting EnableLinqExpressions true and false.

The DataSource I'm setting is an IQueryable<Question>.  With EnableLinqExpressions not set, filtering fails.  But, setting ELE=false, filtering works great.

I presume with ELE set to default, the grid tries to attach a .Where(....) linq clause to the DataSource, and there's something about my DataSource where that doesn't filter.  With ELE=false, the grid must iterate over the DataSource and manually inspect each row.

Anyway, it's working with ELE=false, just looking for a more in-depth understanding of that setting.  Not something that really needs to be addressed.
0
Vlad
Telerik team
answered on 10 Sep 2008, 02:22 PM
Hello golddog,

Can you verify if you have ToList() call for this IQueryable? I will appreciate if you can send/post small example demonstrating this.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
golddog
Top achievements
Rank 1
Answers by
golddog
Top achievements
Rank 1
Iana Tsolova
Telerik team
Vlad
Telerik team
Share this question
or