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

Pressing Enter in a textbox in the filter row of RadGrid shows filter dropdown of next column

3 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 13 Nov 2013, 01:40 AM
I have a very odd problem with one of my RadGrids...

I initially had a problem where I couldn't type double quotes (") into the filter boxes in my RadGrid..  I could type any other character including single quotes (') in, but not doubles.

I eventually tracked it down to this line inside the ClientSettings tag for the grid :
<KeyboardNavigationSettings AllowSubmitOnEnter="true" EnableKeyboardShortcuts="true" />

If AllowSubmitOnEnter is false or removed from the code, I could enter double quotes.

Then I noticed that when I press the enter key inside one of my textboxes up in the filter row of the grid, the filter dropdown list for the column to the right was shown.  It has the same effect as if I'd clicked on the "Filter" icon next to the filter box in the adjacent column.  The list shows in the top left corner of the screen.

My custom code to show a new RadWindow still fires, correctly, but my client won't accept this as it stands..

I have attached a screenshot of what happens..
- Capture1.png shows whats on screen
- Capture2.png shows what happens when I hit Enter in the first textbox.

I will post a stripped down version of my page with as much removed as possible while still showing the problem.

If AllowSubmitOnEnter is false or removed from the code, I could enter double quotes, but this problem shows.  If I set AllowSubmitOnEnter back to "true", the problem disappears, but I can't enter double quotes into any of my filter textboxes.

Does anyone have any idea what or why this is happening..???

Thanks

3 Answers, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 13 Nov 2013, 01:44 AM
Default2.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Merch_Default2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
  <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="scm" runat="server" ScriptMode="release" EnablePageMethods="true" />
 
        <telerik:RadGrid ID="rgdMerchItemList" runat="server" AllowFilteringByColumn="True">
            <ClientSettings AllowKeyboardNavigation="true">
                <ClientEvents />
                <%--**********************************************************************************************************************************************
                        // Started playing with these values because
 
                        AllowSubmitOnEnter  EnableKeyboardShortcuts Quotes Work   Drop-Down Shows
                        TRUE                TRUE                    No                  No
                        TRUE                FALSE                   No                  No
                        FALSE               TRUE                    Yes                 No
                        <removed from code>  TRUE                    Yes                 No
                        <removed from code>  FALSE                   No                  No
                        TRUE                <removed from code>      No                  No
                        FALSE               <removed from code>      Yes                 No
                        <removed from code>  <removed from code>      Yes                 No
 
                        **********************************************************************************************************************************************--%>
                <KeyboardNavigationSettings AllowSubmitOnEnter="false" EnableKeyboardShortcuts="true" />
                <%--**********************************************************************************************************************************************--%>
            </ClientSettings>
            <MasterTableView CommandItemDisplay="None">
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="Item ID" UniqueName="itemId" FilterControlWidth="79" HeaderStyle-Width="120" ShowFilterIcon="False">
                        <FilterTemplate>
                            <telerik:RadTextBox runat="server" ID="txtItemIdFilter" Width="80" MaxLength="12" />
                        </FilterTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridTemplateColumn HeaderText="Title" UniqueName="title">
                        <ItemTemplate>
                            <span class="sptitle">Dummy Text</span>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
 
                </Columns>
            </MasterTableView>
            <ExportSettings ExportOnlyData="true" IgnorePaging="true" FileName="MerchItems" />
        </telerik:RadGrid>
    </form>
</body>
</html>

Default2.aspx.vb

Imports System.Data
 
Partial Class Merch_Default2
    Inherits System.Web.UI.Page
 
    Protected Sub rgdMerchItemList_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgdMerchItemList.NeedDataSource
        rgdMerchItemList.DataSource = New DataTable()
    End Sub
 
End Class
0
Pavlina
Telerik team
answered on 15 Nov 2013, 02:45 PM
Hello Adam,

RadGrid does not support filtering with double quotes, because they are illegal character. However, to achieve your goal you could exclude the " sign from the list using the following code to the page with the grid:
protected override void OnInit(EventArgs e) 
    base.OnInit(e); 
    GridFilterFunction.IllegalStrings = new string[] { " LIKE ", " AND ", " OR ", ">", "<", "<>", " NULL ", " IS " }; 
}

This will override the default illegal characters, but have in mind that this is not a supported scenario.

Regards,
Pavlina
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Adam
Top achievements
Rank 1
answered on 18 Nov 2013, 12:58 AM
ok, that makes sense that it doesn't like " in a filter expression..  so maybe I'll set the values back to true:
AllowSubmitOnEnter="true" EnableKeyboardShortcuts="true"

The reason I came across this problem initially is because I have a textbox for a "title" column in the grid...  I have some inline editing code implemented which displays a textbox to the user and they can enter a new title for their product and hit "save"...

The problem is that they can't enter " into those boxes either..  so these are textboxes in the grid cells..  so whatever code stops the " in the filter fields, flows down into the cells as well..

What I may end up doing is allowing " in the filters using the code you've provided to override the default functionality, then using some jquery to disallow the " in certain textboxes, eg: filters..

I'll post back when I've been able to try your code..

Thanks
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or