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

RadGrid ClearFilter

5 Answers 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sirisha
Top achievements
Rank 1
sirisha asked on 07 Jun 2011, 09:55 PM
I'm usig the clearfilter functionality as described in the below demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
 You can see in the demo, type something in the filter box and before filtering(before clicking enter or tab) if you click on clear filter button, it is filtering the grid instead of clearing the filter text box as it is firing the filtercommand..Is there a way to fix this.

5 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 10 Jun 2011, 03:42 PM
Hi sirisha,

Can you share your grid declaration? I assume the reason for the problem is that the filter textbox you type in has AutoPostBack set to true, or the grid column has AutoPostBackOnFilter set to true. Thus when you click the clear button instead of its Click event to fire, as the filter textbox looses focus, it postbacks and filtering is performed.
I will check it out and try to find a way around the issue.

Greetings,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
sirisha
Top achievements
Rank 1
answered on 15 Jun 2011, 08:06 PM
<telerik:RadGrid ID="GridView_Orders" runat="server" AutoGenerateColumns="false" AllowSorting="true" 
     AllowFilteringByColumn="true"  OnNeedDataSource="GridView_Orders_OnNeedDataSource"   OnItemDataBound="GridView_Orders_OnItemDataBound"
               OnItemCommand="GridView_Orders_OnItemCommand" AllowPaging="true" PageSize="25" EnableLinqExpressions="false" >
                 
               <MasterTableView DataKeyNames="OrderID" PagerStyle-Mode="NextPrevAndNumeric" PagerStyle-AlwaysVisible="true">
               <Columns>
                   <telerik:GridTemplateColumn>
                       <ItemTemplate>
                           <telerik:RadButton ID="buttonViewOrderDetails" runat="server" runat="server" Text="View Copy" 
                                CommandName="ViewOrderDetails" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"OrderID")%>'>
                           </telerik:RadButton>
                             
                       </ItemTemplate>
                        <FilterTemplate>
                                <asp:ImageButton ID="lnkClearFilters" runat="server" ImageUrl="~/Media/Images/removefilter.png"
                                  OnClick="ClearFilters_Click" AlternateText="Clear Filters" />
                        </FilterTemplate>
                   </telerik:GridTemplateColumn>
                     
                   <telerik:GridTemplateColumn AllowFiltering="false">
                       <ItemTemplate>
                           <asp:Image ID="imgCopySet" BackColor="Transparent" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "dcOrderCopySetExists") %>'/>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn AllowFiltering="false">
                       <ItemTemplate>
                           <asp:Image ID="imgSpotMatchStatus" BackColor="Transparent" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "dcOrderSpotMatchStatus") %>'/>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridTemplateColumn AllowFiltering="false">
                       <ItemTemplate>
                           <asp:ImageButton ID="imgOrderDocument" BackColor="Transparent" runat="server" 
                                ImageUrl='<%# DataBinder.Eval(Container.DataItem, "dcOrderDocumentExists") %>'
                                OnClick='<%# ShowDocument(Eval("OrderID"),Eval("TimDB"),Eval("dcOrderDocumentExists")) %>' 
                                AlternateText="View Contract"/>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridBoundColumn DataField="OrderID" UniqueName="OrderID" HeaderText="Order ID" FilterControlWidth="50px"
                       CurrentFilterFunction="EqualTo" ShowFilterIcon="false"  AutoPostBackOnFilter="true">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="OrdDescription" UniqueName="OrdDescription" HeaderText="Description" AllowFiltering="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="AgencyName" UniqueName="AgencyName" HeaderText="Agency" AllowFiltering="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="ClientName" UniqueName="ClientName" HeaderText="Client" FilterControlWidth="100px"
                       CurrentFilterFunction="Contains" ShowFilterIcon="false"  AutoPostBackOnFilter="true">
                   </telerik:GridBoundColumn>
                   <telerik:GridDateTimeColumn DataField="FlightStart" UniqueName="FlightStart" HeaderText="Flight Start" DataFormatString="{0:d}" AllowFiltering="false">
                   </telerik:GridDateTimeColumn>
                   <telerik:GridDateTimeColumn DataField="FlightEnd" UniqueName="FlightEnd" HeaderText="Flight End" DataFormatString="{0:d}" AllowFiltering="false">
                   </telerik:GridDateTimeColumn>
                   <custom:CustomFilterColumn DataField="OrdStatusDescription" UniqueName="OrdStatusDescription" HeaderText="Status">
                   </custom:CustomFilterColumn>
                   <telerik:GridBoundColumn DataField="TimDB" UniqueName="TimDB" HeaderText="Tim" AllowFiltering="false">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="Cancelled" UniqueName="Cancelled" Display="false">
                   </telerik:GridBoundColumn>
               </Columns>
               </MasterTableView>
           </telerik:RadGrid>
above is the declaration of my grid. I did set the Autopostback of grid column to true.
0
Iana Tsolova
Telerik team
answered on 17 Jun 2011, 11:21 AM
Hi sirisha,

If it working the same way when the AutoPostBackOnFilter property is false?
Otherwise the described behavior is rather expected as described in my previous post.

Best wishes,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
sirisha
Top achievements
Rank 1
answered on 20 Jun 2011, 04:54 PM
if I change the autopostback property of column to false, filtering will not happen on click of enter. Is there a way to resolve this with autoppostback property of the column set to true...
0
Iana Tsolova
Telerik team
answered on 21 Jun 2011, 12:49 PM
Hi sirisha,

No, you cannot change the current behavior when the AutoPostBackOnFilter is set to true. What you can do instead is to handle the onkeydown client-side event of each of the filter textboxes. There check if [Enter] is pressed, execute custom javascript to fire the filter command for the column manually (as in this demo for instance). Otherwise, do nothing.

Regards,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
sirisha
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
sirisha
Top achievements
Rank 1
Share this question
or