Hi,
I am using a Rad Grid control inside a user control. I have to support automatic inserts and edits - the insert is implemented by clicking a button in the command item template, and the editing is done by double-clicking the row that contains the item. I have hooked it up with the RowDoubleClick event in the ClientEvents tag and have implemented a custom javascript logic that keeps track of the edited items and triggers ajax requests to the server using a RadAjaxManager. I would like to be able to commit any pending changes to the currently edited item, if I double-click on another one (and have only one active editor).
the code for this looks like
function RowDblClick(sender, eventArgs) {
requestCommit(); // commits any changes to the server to be recorded.
// initialize items that keep the currently selected row's data.
}
function requestCommit() {
var result = false;
.....
// if updating
manager.ajaxRequest(...);// pass the data to the server to perform update
// else if inserting
manager.ajaxRequest(...);// pass the data to the server to perform insert
// other code skipped for clarity
return result; // result is true if request attempt was made
}
function GridKeyPress(sender, eventArgs) {
var c = eventArgs.get_keyCode();
if (c == 13) {
requestCommit();
}
}
This code works fine when I press the enter key - the data is successfully submitted. However, I want to submit it when I doubleclick on another row - unfortunately nothing happens - Firebug says that the request was aborted. This happens on FF, IE7, 8 and chrome (I did not test it elsewhere). When I add an alert tag in the requestCommit method before it returns, all works fine.
Regards,
Ivaylo Slavov
I am using a Rad Grid control inside a user control. I have to support automatic inserts and edits - the insert is implemented by clicking a button in the command item template, and the editing is done by double-clicking the row that contains the item. I have hooked it up with the RowDoubleClick event in the ClientEvents tag and have implemented a custom javascript logic that keeps track of the edited items and triggers ajax requests to the server using a RadAjaxManager. I would like to be able to commit any pending changes to the currently edited item, if I double-click on another one (and have only one active editor).
the code for this looks like
function RowDblClick(sender, eventArgs) {
requestCommit(); // commits any changes to the server to be recorded.
// initialize items that keep the currently selected row's data.
}
function requestCommit() {
var result = false;
.....
// if updating
manager.ajaxRequest(...);// pass the data to the server to perform update
// else if inserting
manager.ajaxRequest(...);// pass the data to the server to perform insert
// other code skipped for clarity
return result; // result is true if request attempt was made
}
function GridKeyPress(sender, eventArgs) {
var c = eventArgs.get_keyCode();
if (c == 13) {
requestCommit();
}
}
This code works fine when I press the enter key - the data is successfully submitted. However, I want to submit it when I doubleclick on another row - unfortunately nothing happens - Firebug says that the request was aborted. This happens on FF, IE7, 8 and chrome (I did not test it elsewhere). When I add an alert tag in the requestCommit method before it returns, all works fine.
Regards,
Ivaylo Slavov