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

CurrentFilterFunction shows wrong value- RadGrid

4 Answers 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
amit
Top achievements
Rank 1
amit asked on 21 Oct 2014, 08:29 AM
RadGrid's filter button property 'CurrentFilterFunction'  showing previous selected value

I am have gone through the below steps and facing some issues :

(1) Page load first time -> CurrentFilterFunction shows 'NoFilter' -> works fine
(2) Enter text in TextBox -> Press tab -> CurrentFilterFunction shows 'Contains'-> works fine
(3) Enter text in TextBox-> press filter button -> select 'DoesNotContains' from drop down list -> CurrentFilterFunction shows 'Contains'(wrong value, it should shows
                                                                                                                                                                                                                                                  'DoesNotContains' )
(4) Enter text in TextBox -> press filter button -> select 'StartsWith' from drop down list -> CurrentFilterFunction shows 'DoesNotContains'(wrong value, , it should
                                                                                                                                                                                                                                             shows 'StartsWith')

can anyone please tell me the reason of this behavior and what is the solution of it. 

below is the code snippet :

<telerik:RadGrid ID="gvParameterLookup" runat="server" AllowSorting="true" CellSpacing="0"
                    CellPadding="2" GridLines="none" HeaderStyle-CssClass="dnnGridHeader" AllowFilteringByColumn="true"
                    AutoGenerateColumns="false" AllowAutomaticUpdates="false" AllowPaging="false"
                    EnableEmbeddedBaseStylesheet="false" EnableEmbeddedSkins="false" >
                    <groupingsettings casesensitive="false" />
                    <mastertableview allowfilteringbycolumn="true" allowpaging="false">                          
                    <Columns>                    
                        
                        <telerik:GridTemplateColumn DataField="Subsystem" SortExpression="Subsystem" CurrentFilterFunction="Contains" 
  UniqueName="Subsystem"  AutoPostBackOnFilter="True" HeaderText="Subsystem">
                            <HeaderStyle Font-Bold="true" />
                            <HeaderTemplate>Subsystem</HeaderTemplate>
                            <ItemTemplate><%# Eval("Subsystem")%></ItemTemplate>
                        </telerik:GridTemplateColumn>

                            </Columns>
                    </mastertableview>
                    <clientsettings enablepostbackonrowclick="false" />
                </telerik:RadGrid>

4 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 23 Oct 2014, 03:01 PM
Hi Amit,

The issue which you are experience is expected because the filtering is executed right after the focus of the TextBox is lost. For instance when you enter a value the grid will be filter by the previous applied filter function and when you select a new filter function it will be filter again. I would recommend you disable the AutoPostBackOnFilter which cause this behavior. Note that this property is useful when the filter icon is hidden and only one filter function is applied.

Regards,
Kostadin
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.

 
0
amit
Top achievements
Rank 1
answered on 28 Oct 2014, 05:09 AM
Thanks for your reply  kostadin....
what I did now :
 I set AutoPostBackOnFilter ="False"  and when page is loaded first time it shows all values which is correct(because by default "NoFilter" is applied ) then I  provided some filter value in textbox and click on filter button and select 'contains' then still  CurrentFilterFunction shows me 'NoFilter' (which was set when page was loaded first time).
 after that  I select 'DoesNotContains' but CurrentFilterFunction shows me "Contians"(Previous selected value).

Second my project requirement is : user provide some filter value in textbox and press 'tab' key then it should shows filter value.

Kind Regards
Amit Kumar






0
Kostadin
Telerik team
answered on 30 Oct 2014, 04:31 PM
Hi Amit,

I prepared a small sample where you can see that when AutoPostBackOnFilter is set to false it filters the column based on the selected filter function from the menu. Additionally if you need to filter when a user enter a value in the TextBox and press the Tab key you have to enable theAutoPostBackOnFilter property. You can see the first two columns in the project which are modified to use the two requested scenarios.

Regards,
Kostadin
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.

 
0
amit
Top achievements
Rank 1
answered on 31 Oct 2014, 04:18 AM
Thanks kostadin,

It means my problem can not be resolved because it is technical constraint.
By the way I have resolved it by using EventArgs e not Object sender. Object sender shows the previous selected value while argument e shows current selected CurrentFilterFunction  value.

Amit Kumar
Tags
Grid
Asked by
amit
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
amit
Top achievements
Rank 1
Share this question
or