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

[Solved] Editable Grid and Auto Save row when user leaves row

3 Answers 534 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 07 May 2009, 05:16 AM
Hi,

I have a Grid which is all in edit mode, meaning that the user can start editing straight away without clicking on an "Edit" button.

I want to be able to catch the event when a user leaves the row and to perform validation and a save at that point.

All the examples I have found do not help me as most examples expect the user to click an "Edit" button and a "Save" button.  I don't want the user to click any buttons.

Is there a way of detecting when a user has left a row?

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 11 May 2009, 02:06 PM
Hi J,

You may consider intercepting the onchange event of the grid textbox column editors as illustrated on this demo to trigger either client or server validation based on the input entries. Additionally, to learn more about the flexible validation mechanism of our web grid, review the online example linked below:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/validation/defaultcs.aspx

Best regards,
Sebastian
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
J
Top achievements
Rank 1
answered on 11 May 2009, 11:32 PM
Sorry but this example doesn't help me.  In the example, the user clicks on the row to set it to edit mode which in turn returns the ID of the row that raised the event to set it to edit mode.

The issue is, my rows are already in edit mode and even if I catch the onchange event of the text box, I don't know how to determine which row it comes from.

Another issue is that the RowClicked event is only raised if the user clicks on an uneditable portion of the row.  As my row is all editable, If the user clicks in one of the editable textbox the event  RowClicked is not raised. 
0
Sebastian
Telerik team
answered on 14 May 2009, 01:27 PM
Hi J,

Thank you for the clarification - now I see your point more clearly.

You can get reference to the active table row in the grid using the approach from this code library thread and extract the key field value using GetCellByColumnUniqueName(colName, row).innerHTML to fetch the cell content from the key column. Then you can identify the item and update the source record on the server if necessary.

I hope this approach is feasible for your situation. The validation can be either custom approach of ours or utilizing the ASP.NET validation/grid validation mechanism.

Kind regards,
Sebastian
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.
Tags
Grid
Asked by
J
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
J
Top achievements
Rank 1
Share this question
or