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

[Solved] filtercriteria should be "Contains" on enter key

19 Answers 375 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sandeep Pulkundwar
Top achievements
Rank 1
Sandeep Pulkundwar asked on 09 Mar 2009, 06:21 AM
Hi,
In radgrid i want  the default criteria for filter to be "contains" on enter key press. Like if i give the filter criteria in names column as "s" and press enter key then it should show the result rather opening the filter menu and selecting "contains" from the menu.

19 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 09 Mar 2009, 07:17 AM
Hello Sandeep,

If you set AutoPostBackOnFilter property of the corresponding column to true you can trigger postback filter operation for Contains (for string types) and EqualTo (for numeric types) when you type in the filter box and press [Enter] from the keyboard. Moreover, you can execute other type of filter action by setting the CurrentFilterFunction property of the corresponding column to an internally recognized value.

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 17 Mar 2009, 06:19 AM
Hi Nikolay,

Thanks for your reply. I have tried what you have asked for but its not working for [Enter] its doing that action on [Tab] key press.
 The below is my grid structure, see if i am missing something in it.

<

telerik:RadGrid ID="grdList" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="True"

 

 

AllowSorting="True" AllowPaging="True" PageSize="5" OnNeedDataSource="grdList_NeedDataSource"

 

 

Skin="Default" PagerStyle-AlwaysVisible="true" OnItemCreated="grdList_ItemCreated"

 

 

EnableEmbeddedSkins="False" OnItemCommand="grdList_ItemCommand" meta:resourcekey="grdListResource1"

 

 

OnPreRender="grdList_PreRender" OnPageIndexChanged="grdList_PageIndexChanged"

 

 

EnableLinqExpressions="False" GridLines="None">

 

 

<GroupingSettings CaseSensitive="false" />

 

 

<HeaderContextMenu Skin="Default" EnableEmbeddedSkins="False" EnableTheming="True">

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</HeaderContextMenu>

 

 

<PagerStyle AlwaysVisible="True"></PagerStyle>

 

 

<MasterTableView CommandItemDisplay="None" AutoGenerateColumns="False" Width="100%"

 

 

AllowFilteringByColumn="true">

 

 

<EditFormSettings>

 

 

<EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif"

 

 

CancelImageUrl="Cancel.gif">

 

 

</EditColumn>

 

 

</EditFormSettings>

 

 

<PagerStyle Mode="Slider" />

 

 

<CommandItemSettings AddNewRecordImageUrl="AddRecord.gif" RefreshImageUrl="Refresh.gif">

 

 

</CommandItemSettings>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="UserGroupId" HeaderText="ID" ReadOnly="True"

 

 

SortExpression="UserGroupId" UniqueName="UserGroupId" Visible="false" CurrentFilterFunction="Contains"

 

 

meta:resourcekey="GridBoundColumnResource2">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridHyperLinkColumn HeaderText="User Groups" AutoPostBackOnFilter="true" DataTextField="Name" DataType="System.String"

 

 

DataNavigateUrlFields="UserGroupId" DataNavigateUrlFormatString="UserGroupEdit.aspx?Id={0}"

 

 

UniqueName="Name" SortExpression="Name" CurrentFilterFunction="Contains" FilterListOptions="VaryByDataType"

 

 

meta:resourcekey="GridHyperLinkColumnResource3">

 

 

</telerik:GridHyperLinkColumn>

 

 

<telerik:GridHyperLinkColumn HeaderText="Copy User Group" DataType="System.String" DataNavigateUrlFields="UserGroupId"

 

 

DataNavigateUrlFormatString="UserGroupEdit.aspx?CopyId={0}" UniqueName="Copy"

 

 

AllowFiltering="false" Text="Copy/Add" meta:resourcekey="GridHyperLinkColumnResource4">

 

 

</telerik:GridHyperLinkColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Active" UniqueName="IsActive" HeaderStyle-HorizontalAlign="Center"

 

 

ItemStyle-HorizontalAlign="Center" SortExpression="IsActive" DataField="IsActive"

 

 

Resizable="false" ItemStyle-Width="20%" meta:resourcekey="GridTemplateColumnResource2">

 

 

<ItemTemplate>

 

 

<asp:CheckBox ID="chkActive" runat="server" AutoPostBack="True" Checked='<%# Bind("IsActive") %>'

 

 

OnCheckedChanged="chkActive_CheckedChanged" meta:resourcekey="chkActiveResource2" />

 

 

</ItemTemplate>

 

 

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Center" Width="20%"></ItemStyle>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowKeyboardNavigation="true">

 

 

<Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />

 

 

<ClientEvents OnColumnContextMenu="ColumnContextMenu" />

 

 

</ClientSettings>

 

 

<FilterMenu Skin="Default" EnableEmbeddedSkins="False" EnableTheming="True">

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</FilterMenu>

 

 

</telerik:RadGrid>

Thanks
Sandeep

 

0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 17 Mar 2009, 06:59 AM
Hi Nikolay,
Even this works for the first time i mention the filter criteria, second time i have to refresh the page for the criteria to work on key press again.
0
Nikolay Rusev
Telerik team
answered on 19 Mar 2009, 12:49 PM
Hello Sandeep Pulkundwar,

I suggest you upgrade to latest version and see if the same behaviour can be observed.
I belive this is fixed in Q1 Release of RadControls for ASP.NET AJAX.

All the best,
Nikolay
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 19 Mar 2009, 02:19 PM
Hi Nikolay,

Could you please give me the link for the Latest version, i am not able to figure it out where exactly i can find it.

Thanks
Sandeep
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Mar 2009, 10:58 AM
Hi Sandeep,

Here is a KB article which explains how to upgrade  Radcontrols from one version to another.
Updating RadControls for ASP.NET to another version or license



You may refer the following link where you can buy the individual product.
Purchase Individual Product

You can also download the trial version from here.
Free Trials

Thanks
Shinu

0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 15 Apr 2009, 07:20 AM
Hi,

The new issue which i am facing with this is, if i enter something in filter criteria and click(mouse click) on filter icons for Filter menu it first filters and then i need to click again for filter options.
This should not happen as the default filtering is on enter key and not on mouse click.
Do i need to add something for default filtering on just enter key and not on any other key press?
0
Sebastian
Telerik team
answered on 15 Apr 2009, 08:06 AM
Hello Sandeep,

You can either enable filtering on Enter key press or disable it and use the filtering menu options as demonstrated on this online demo of the product:

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx

The filtering operation is triggered on blur of the filter control, hence you will need to choice either the first or the second option depending on your particular needs.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 15 Apr 2009, 09:17 AM
Hi sebastian,

I don't want the event to trigger on OnBlur, i want it on enter key press.
Please suggest any workaround for it, otherwise this functionality is of no use.

Thanks,
Sandeep
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 17 Apr 2009, 04:40 AM
Hi,

I am in urgent need for this functionality, please provide me with some workaround.
I want this functionality on key press rather than onBlur.
0
Sebastian
Telerik team
answered on 17 Apr 2009, 03:30 PM
Hello Sandeep,

If you would like to implement filtering on Enter key press, you will need to hide the filtering icon and perform filter operation in this way as it will be triggered on blur. Unfortunately there is no universal mechanism to trigger the action on Enter key press only, hence if you would like to enable both options at the same time, you will need to do that with your custom implementation.

A possible alternative approach is presented on this demo of the product:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmailgrid/defaultcs.aspx

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 21 Apr 2009, 05:03 AM
Hi,

Can you provide some sample on custom implementation?
The alternative solution is not what i need. So please can you provide some sample on custom implementation
0
Sebastian
Telerik team
answered on 23 Apr 2009, 11:38 AM
Hello Sandeep,

One possible custom implementation is provided in the demo linked in my previous post. If you find another solution, feel free to implement it and post it in this public forum thread to be available for other community members as well. Your effort will be rewarded with Telerik points that can be used as a discount for future upgrades/purchases of our controls.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sandeep Pulkundwar
Top achievements
Rank 1
answered on 25 Apr 2009, 05:07 AM

Hi,

 

Thanks for your reply. Can we disable onblur event and fire filtering event through javascript.

What I want to do is, when user presses Enter key I want to call filtering event using javascript.

Onfocus event of filter textbox I should be able to store that filter textbox id in hidden field and on press of enter key

I can get value in filter text box and fire filtering event using javascript.

Is it making sense?

 

0
Sebastian
Telerik team
answered on 27 Apr 2009, 08:47 AM
Hello Sandeep,

You may consider implementing your custom solution intercepting the onblur event of the filter textboxes manually inside the ItemCreated handler and the OnKeyPress client event of the grid to determine when [Enter] key is pressed.

To trigger filtering operation from the client, you can use the filter method of the grid as demonstrated on this demo.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sebastian
Telerik team
answered on 08 May 2009, 03:42 PM
Hello Sandeep,

Please excuse me if my previous directions were a bit misleading for you. Actually you need to cancel the onchange event for the filter textboxes for columns with AutoPostBackOnFilter = true setting and do not need to intercept the OnKeyPress event of the grid at all.

For your convenience I prepared a test project which illustrates how this can be done for the OrderID and ShipName columns in the grid. Let me know whether this helps.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Manuel Ortiz
Top achievements
Rank 1
answered on 19 Feb 2010, 05:42 AM
Hello, following the previous example, the following eliminates the "onblur" or "onchange" filtering value when AutoPostBackonFilter is True so that it only filters when the user presses enter on the filter box.

Thanx,
Manuel
Protected Sub rgMasterGrid_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgMasterGrid.ItemCreated 
        If TypeOf e.Item Is GridFilteringItem Then 
            Dim filterItem As GridFilteringItem = CType(e.Item, GridFilteringItem) 
 
            For Each filtercell As TableCell In filterItem.Cells 
                For Each cellcontrol As Object In filtercell.Controls 
                    If TypeOf cellcontrol Is TextBox Then 
                        CType(cellcontrol, TextBox).Attributes("onchange") = "" 
                    End If 
                Next 
            Next 
           
        End If 
    End Sub 
 


0
Julie Gephart
Top achievements
Rank 1
answered on 22 Feb 2010, 06:53 PM
Thanks for the clear sample.

I'd like to add my vote that supporting the Enter key on the filter boxes should be default behavior for the grid without all these workarounds.  This comes up every time I try to use RadGrid filters from users at every level of technical expertise - being able to hit Enter inside a textbox and have something happen is a pretty universal web standard, and it's the primary complaint that keeps me from being able to use this powerful feature more often.  I can't even get the AutoPostBackOnFilter="true" to be applied by using a skin, and having to make sure everyone on my team remembers to add that attribute to every filterable column in every grid is not a workable option.
0
Sebastian
Telerik team
answered on 24 Feb 2010, 02:50 PM
Hello Julie,

Thank you for your feedback. I will forward your proposal to our developers to be considered further.

However, I am afraid that such modification will introduce a breaking change in RadGrid for ASP.NET AJAX which will affect all existing clients when migrating to a newer version of the product. Our goal is to avoid breaking changes unless they are absolutely necessary. That is why you may consider configuring the filter on [ENTER] key press manually - I hope this is feasible solution for you.

Kind regards,
Sebastian
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Sandeep Pulkundwar
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Sandeep Pulkundwar
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Sebastian
Telerik team
Manuel Ortiz
Top achievements
Rank 1
Julie Gephart
Top achievements
Rank 1
Share this question
or