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

Avoid itemCommand after enter key is pressed

6 Answers 196 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 11 May 2012, 01:43 PM
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.

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 May 2012, 06:10 AM
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.
0
Ram
Top achievements
Rank 1
answered on 14 May 2012, 09:13 AM
Thanks Princy... This workaround fixed my issue ... :-)
0
Loyal User
Top achievements
Rank 1
answered on 18 Jan 2014, 12:16 PM
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.
0
Kostadin
Telerik team
answered on 22 Jan 2014, 02:30 PM
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.
0
Loyal User
Top achievements
Rank 1
answered on 23 Jan 2014, 07:34 AM
thanks a lot  Kostadin 

Great ,
 That's exactly what i'm looking for 
0
Sanjey
Top achievements
Rank 2
answered on 10 Feb 2016, 06:12 PM
Thanks, Its Work like charm
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ram
Top achievements
Rank 1
Loyal User
Top achievements
Rank 1
Kostadin
Telerik team
Sanjey
Top achievements
Rank 2
Share this question
or