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

[Solved] Default Button when in edit mode.

3 Answers 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Wolfe
Top achievements
Rank 1
Steve Wolfe asked on 21 Jan 2010, 01:38 AM
I have a grid that is part of a user control.  Everything is working fine, except when editing an item. When you are inside one of the textbox of the GridBoundColumns and press the "Enter" key, the "Add new record" command button gets pressed and the insert form is opened up.

I guess I could disable the insert button when in edit mode, but I would prefer that the default button when in the editform be the submit button of the editform. 

All the examples I have tried seem to work they way I want them to, but I can't see why my grid behaves differently.

Help or suggestions would be appreciated.

-Steve

3 Answers, 1 is accepted

Sort by
0
Steve Wolfe
Top achievements
Rank 1
answered on 21 Jan 2010, 04:42 AM
In doing some continued research, I believe this behavior is a bug/feature of the new release fo the telerik controls.  I downloaded and ran the example from http://www.telerik.com/community/code-library/aspnet-ajax/grid/automatic-operations-with-objectdatasource-control.aspx

This examples ships and uses version 2007_3_1425+. 

In the example, if you are editing a row and are in any of the textbox controls, when you hit enter nothing happens.  Now take that same demo code and have it use the lastest 2009.3.1208.35.  Using the new dll, when you hit enter while in one of the textboxes while editing a row, the "add new record" button get pressed and the insert form is displayed along with your edit form.

I would like be able to have the old behavior, is there at least a workaround for this?

-Steve
0
Yavor
Telerik team
answered on 22 Jan 2010, 06:46 AM
Hi Steve,

Our system shows that you have opened a support ticket, regarding this forum post. To avoid duplicate posts, we can continue our communication in the support ticket.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Steve Wolfe
Top achievements
Rank 1
answered on 22 Jan 2010, 08:58 PM
Sure,

I just wanted the answer to be here where anyone who ran into this issue could find it.  Post response from the support ticket below.

Posted on 14 hours ago

Hi Steve,

Thank you for contacting us and for your question.
Indeed, the behavior which you mentioned is observed. One possible option to alter it is as follows.
When the control enters edit mode, you can get a reference to the UpdateButton. Then, you can set the DefaultButton of the form to point to the id of the Update button. This can be done in the ItemDataBound event handler, when the control enters edit mode.
Alternatively, you can use the onKeyPress client side event handler, to cancel out the default action of the enter key press, and trigger an update for the edited item.
I hope one of these options is suitable for you. If further questions arise, do let me know.

Regards,
Yavor
the Telerik team
Tags
Grid
Asked by
Steve Wolfe
Top achievements
Rank 1
Answers by
Steve Wolfe
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or