HI,
I am using Radgrid In that there are textboxes and buttons for update and cancel. When I am entering Data in the textbox and hit the Enterkey the entire page is post back and reloaded from the server.
So if you know why this is happening Please reply me as early as possible.
Thank You.
I am using Radgrid In that there are textboxes and buttons for update and cancel. When I am entering Data in the textbox and hit the Enterkey the entire page is post back and reloaded from the server.
So if you know why this is happening Please reply me as early as possible.
Thank You.
3 Answers, 1 is accepted
0
Hi rahul,
Have you switched on the KeyboardNavigation feature of the grid? If so and given that you are using the latest service pack of the controls, the grid will perform an update/insert command on ENTER being hit and a cancel command on ESC.
Otherwise, if the grid's keyboard navigation is turned off, perhaps the page is performing a post back on a default button which is hit on ENTER. Therefore, you need to prevent the key press event from bubbling to prevent from reaching the default button. In order to achieve this, attach an event handler to the client OnKeyPress event of the grid and define the client handler method as follows:
I hope this information helps.
Best Regards,
Tsvetoslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Have you switched on the KeyboardNavigation feature of the grid? If so and given that you are using the latest service pack of the controls, the grid will perform an update/insert command on ENTER being hit and a cancel command on ESC.
Otherwise, if the grid's keyboard navigation is turned off, perhaps the page is performing a post back on a default button which is hit on ENTER. Therefore, you need to prevent the key press event from bubbling to prevent from reaching the default button. In order to achieve this, attach an event handler to the client OnKeyPress event of the grid and define the client handler method as follows:
| function keyPressed(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(); |
| } |
| } |
| } |
I hope this information helps.
Best Regards,
Tsvetoslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
rahul
Top achievements
Rank 1
answered on 05 Jun 2009, 10:29 AM
Hello Tsvetoslav,
Thanks for your Reply, But The Radgrid I am using dont have any event like "OnKeyPress" as you suggested to use so I can not use the Function you have provided. Therefore Is there any alternate way to prevent this Enter Key.
Thanks again and Please Reply as early as possible.
Thanks for your Reply, But The Radgrid I am using dont have any event like "OnKeyPress" as you suggested to use so I can not use the Function you have provided. Therefore Is there any alternate way to prevent this Enter Key.
Thanks again and Please Reply as early as possible.
0
Hi rahul,
If you are using RadGrid for ASP.NET or RadGrid for ASP.NET AJAX, you can find the OnKeyPress property in the ClientSettings property section under the ClientEvents tag:
I hope this helps.
Kind regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
If you are using RadGrid for ASP.NET or RadGrid for ASP.NET AJAX, you can find the OnKeyPress property in the ClientSettings property section under the ClientEvents tag:
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| <ClientSettings> |
| <ClientEvents OnKeyPress="keyPressed" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
I hope this helps.
Kind regards,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.