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

Delete command getting fired on enter key press of textbox

3 Answers 196 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kavita
Top achievements
Rank 1
Kavita asked on 25 Mar 2013, 06:49 AM
hi,
I have  more than one rad text box which is multiline and one Radgrid in my page .
When i press enter in any text box, delete command of Radgrid is getting fired which i don't want.
I tried writing a code for not accepting enter key press event but it is also applying to text box which are multiline.
I want enter key to be present in text box but it should not fire any other events of Radgrid.
Please help me. 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Mar 2013, 07:13 AM
Hi,

Check the following forum thread which discussed similar scenario.
RadGrid hit enter anywhere on page fires the Delete command

Thanks,
Shinu
0
Kavita
Top achievements
Rank 1
answered on 25 Mar 2013, 10:03 AM
hey shinu,
I tried your link,but it is not working.
I added the attribute for textbox on pageload, but javascript which is used not getting called.
i had put alert inside it.
Then i changed attribute from AllowKeypress to below 

txtSW1.Attributes.Add("onkeypress", "EscapeKeys(true)")

but then it gave this error..
Microsoft JScript runtime error: 'null' is null or not an object

Delete command is getting called wherever i press enter,not just only in textbox.



0
Daniel
Telerik team
answered on 28 Mar 2013, 11:04 AM
Hello Kavita,

There are two ways around this problem:
- handle the form's onclick event and cancel it when needed
- create a hidden dummy button and set it as default submit button

Best regards,
Daniel
the Telerik team
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 their blog feed now.
Tags
Grid
Asked by
Kavita
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kavita
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or