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

Disable Enter Key for GridClientDeleteColumn

1 Answer 216 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tag
Top achievements
Rank 1
Tag asked on 01 Sep 2011, 07:14 PM
I have a RadGrid with a GridClientDeleteColumn. The table also has a ItemTemplate with a RadNumericTextBox so values can be entered and udpate a total in the footer client side just like this example.

http://mono.telerik.com/Controls/Examples/Integration/GridAndInput/DefaultCS.aspx?product=grid

However, because of the DeleteColumn, whenever a user enters a new value in the TextBox on a row, and hits enter, the row gets deleted, it's firing off the delete event? Why? If I remove the DeleteColumn, of course, this no longer happens.

I tried adding OnClientEvent OnKeyPress event handler to capture the enter being pressed but can't find the documentation to tell me what the 'isEnterKey' property name is that shows in the debugger

Can I disable this somehow so the delete doesn't occur on pressing the enter key and the user has to click the delete button?

<telerik:GridClientDeleteColumn ButtonType="ImageButton" HeaderStyle-Width="25px" ItemStyle-Width="25px" />
...

 

 

 

<telerik:GridTemplateColumn UniqueName="awardCol" DataField="Amount" HeaderText="Amount">

 

 

 

<ItemTemplate>

 

 

 

<telerik:RadNumericTextBox ID="amountEntryField" DataType="System.Double" MinValue="1.0" Value='<%# Eval("Amount") %>' runat="server">

 

 

 

<ClientEvents OnBlur="amtBlur" OnFocus="amtFocus" OnKeyPress="updateAmount" />

 

 

 

</telerik:RadNumericTextBox>

 

 

 

</ItemTemplate>

 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 06 Sep 2011, 04:15 PM
Hello Todd,

This is caused by the form's default button, which in this scenario seems to be the button in the delete column. There are various ways to overcome this, some are described at these addresses:
http://www.telerik.com/community/forums/aspnet-ajax/grid/grid-filter-menu-appearing-in-edit-form.aspx#1407130
http://marekblotny.blogspot.com/2009/03/defaultbutton-deal-with-users-hitting.html
http://www.bloggingdeveloper.com/post/Disable-Form-Submit-on-Enter-Key-Press.aspx


All the best,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
Tag
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or