Avoid itemCommand after enter key is pressed

7 posts, 0 answers
  1. Ram
    Ram avatar
    8 posts
    Member since:
    Dec 2006

    Posted 11 May 2012 Link to this post

    Hi,

    I  have "GridButtonColumn" ( image button ) on my RadGrid. When ever i pressing the enter key, its automatically calling the  itemCommandEvent. 

    In my requirement, user needs to click the image button manually to proceed further. ( ie. Not by enter key click )

    Please let me know, how to avoid the ItemCommandEvent when user clicking enter key.


    Thanks in advance.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 May 2012 Link to this post

    Hi Ram,

    The ItemCommandEvent fires when you press the enter key because the image button of the first RadGrid column turns out to be the first button rendered in the form the grid resides in. That is why it is set as the form's default (submit) button. In order to work around this, you can declare an invisible inactive button and set it to be the default one.

    ASPX:
    <form id="form1" defaultbutton="Button2" runat="server">
    <asp:Button ID="Button2" runat="server" Text="" style="display: none;" OnClientClick="return false;" />

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ram
    Ram avatar
    8 posts
    Member since:
    Dec 2006

    Posted 14 May 2012 Link to this post

    Thanks Princy... This workaround fixed my issue ... :-)
  5. Loyal User
    Loyal User avatar
    37 posts
    Member since:
    Apr 2012

    Posted 18 Jan 2014 Link to this post

    Hello Princy,

    I've the same issue but i use pages with masterpage , so i cant set defaultbutton for 'Form' tag.

    how can i achieve it.. ??

    thanks in advance.
  6. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 22 Jan 2014 Link to this post

    Hi,

    You could add the button into the masterpage right before the ContentPlaceholder.

    Regards,
    Kostadin
    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.
  7. Loyal User
    Loyal User avatar
    37 posts
    Member since:
    Apr 2012

    Posted 23 Jan 2014 Link to this post

    thanks a lot  Kostadin 

    Great ,
     That's exactly what i'm looking for 
  8. Sanjey
    Sanjey  avatar
    1 posts
    Member since:
    Jan 2013

    Posted 10 Feb in reply to Kostadin Link to this post

    Thanks, Its Work like charm
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017