Disable "Enter Key" in Chrome

3 posts, 0 answers
  1. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 23 Jan 2014 Link to this post

    Hi,
    I have one grid with dynamic text boxes are coming from DB. The issue is that If user go to Edit mode in the Grid and then user puts some values in text boxes at the time user clicks the Enter button in Chrome browser, the application will take the another button control and make the changes as per the button event, So i need to disable the Enter Key in chrome browser, But its working fine in firefox browser.
    The issues in in chrome browser only, I have attached my grid and script code snippet below.

    Can anyone help me regarding this issue..

    This is my script..
    function OnEnterKeyPress(sender, args) {
                    var keypressed = args._keyCode;
                    if (keypressed == "13") {
                         document.getElementById('<%=lblMsg.ClientID %>').innerHTML = "Please use the Update Button";
                         args.set_cancel(true);
    }

    This is my Grid..
    // This is my grid //
    <telerik:RadGrid ID="RGRateCorrection" runat="server" AutoGenerateColumns="false"
                        Skin="Vista" OnNeedDataSource="RGRateCorrection_NeedDataSource" OnUpdateCommand="RGRateCorrection_UpdateCommand"
                        Width="1000px" Height="300px" HeaderStyle-Width="500px" ItemStyle-Width="500px"
                        OnItemDataBound="RGRateCorrection_ItemDataBound">
                        <MasterTableView EditMode="InPlace" EnableColumnsViewState="false" Width="1000px">
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="EditCommandColumn">
                                </telerik:GridEditCommandColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings ClientEvents-OnKeyPress="OnEnterKeyPress">
                            <%-- AllowKeyboardNavigation="true"--%>
                            <Scrolling AllowScroll="true" />
                        </ClientSettings>
                    </telerik:RadGrid>


    -Thanks
    Rk.MooRthy
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Jan 2014 Link to this post

    Hi ,

    Please try the following code snippet to disable the Enter key:

    JS:
    function OnEnterKeyPress(sender, args) 
      
        if (args.get_keyCode() == 13) 
           
             var e = args.get_domEvent().rawEvent; 
              e.returnValue = false
              e.cancelBubble = true;                   
              if (e.stopPropagation) 
               
                 e.preventDefault(); 
                 e.stopPropagation(); 
               }              
           }             
       }

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 23 Jan 2014 Link to this post

    Hi Princy,
    Its working fine, thanks for your valuable reply.


    -Thanks
    Rk.MooRthy
Back to Top