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

RadGrid Q3 2008 filtering on enter key

2 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pako
Top achievements
Rank 1
Pako asked on 07 Oct 2010, 09:16 AM

Hi

I'm having some problems with using filtering in radGrid. As you can se in thread title, I'm using quite old version of telerik, but I cannot currently move to newer version.

The problem is, that when I put some text in filter textbox and press enter, default action on page is started (which is emulating click on first button found on page). I've set grid properties, so that it would automatically  filter data in grid on enter key. What I've found is, that JavaScript, that runs after key press, returns false when pressed key is enter. What I would like to achieve is filtering grid data after enter key is pressed. All works fine when I enter some text and press tab key or move focus somewhere else by clicking mouse button.

I couldn't find any info about this behavior on your forum, so I don't know whether it's bug, or maybe I'm doing something wrong.

Here are code samples, that I use in my project. I would really appreciate if you could help me deal with this. Thanks in advance!

Grid code:

01.<telerik:RadGrid ID="gridProjects" runat="server" DataSourceID="ClientProjectsSourceGridData"
02. OnItemDataBound="gridProjects_ItemDataBound" AutoGenerateColumns="false" PageSize="15"
AllowPaging="true" AllowSorting="true" CssClass="GridProjectsStyle"
OnSelectedIndexChanged="gridProjects_SelectedIndexChanged"
03.BorderStyle="None" AllowFilteringByColumn="true" EnableLinqExpressions="false">
04.    <GroupingSettings CaseSensitive="false" />
05.    <HeaderStyle CssClass="GridHeader" />
06.    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
07.        <Selecting AllowRowSelect="true" />
08.    </ClientSettings>
09.    <MasterTableView OverrideDataSourceControlSorting="true" AllowFilteringByColumn="true">
10.        <Columns>
11.            <telerik:GridTemplateColumn HeaderText="Project" DataField="Name" SortExpression="Name"
                                        UniqueName="Name" AutoPostBackOnFilter="true"
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false">
12.                 <ItemTemplate>
13.                     <asp:HyperLink ID="ProjectName" runat="server" CssClass="ProjectNameLink"
                                    NavigateUrl='<%# "ProjectDetails.aspx?projectId=" + Eval("Identity").ToString() %>'>
                                    <%#Eval("Name")%>
                     </asp:HyperLink>
14.                 </ItemTemplate>
15.            </telerik:GridTemplateColumn>

HTML and JavaScript generated from this code:

1.<input type="text" onkeydown="if((event.keyCode == 13 || event.keyCode == 20)) return false;"
onchange="setTimeout(function(){$find("ctl00_ContentPlaceHolder1_gridProjects_ctl00").filter("Name", $get("ctl00_ContentPlaceHolder1_gridProjects_ctl00_ctl02_ctl02_FilterTextBox_Name").value);}, 0);"
class="rgFilterBox" id="ctl00_ContentPlaceHolder1_gridProjects_ctl00_ctl02_ctl02_FilterTextBox_Name"
size="10" name="ctl00$ContentPlaceHolder1$gridProjects$ctl00$ctl02$ctl02$FilterTextBox_Name">

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 12 Oct 2010, 01:15 PM
Hi Pako,

I am attaching a sample project compiled against a newer version of RadControls but it should also work with Q3 2008. Please, check if this executes fine under your configuration too.

Sincerely yours,
Tsvetina
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
0
Pako
Top achievements
Rank 1
answered on 12 Oct 2010, 01:30 PM

Hi

Thanks for your response. I've checked app you have posted and all seems to work fine. I had quick look into your code and i see, how you did this. When I'll have time, I'll try to apply this solution to my project to see, how it works.

Thanks again!

Cheers!

Tags
Grid
Asked by
Pako
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Pako
Top achievements
Rank 1
Share this question
or