This sample demonstrates how to update a primary grid data in response to changes made within a detail grid. By design, ASPxGridView can update its own rendering when processing a callback, but not the rending of outside controls. Thus, to refresh the main grid data, it is necessary to call the Refresh method when the detail grid data has been changed. Handle the detail grid EndCallback event handler for this. To overcome the circularity, also handle the BeginCallback event as follows:
[ASPx]<ClientSideEventsEndCallback="OnEndCallback"BeginCallback="OnBeginCallback"/>
[JScript]var command = "";function OnBeginCallback(s, e){ command = e.command;}function OnEndCallback(s, e){if(command == "ADDNEWROW"){ s.Refresh();}}
See also:
Automatically refresh the primary grid on changing secondary grid's data
Question Comments
Added By: Krzysztof Zak at: 7/30/2015 5:15:08 AM
When we got error on post data then error message (below detail grid) appears and quickly disappears. My solution:
[ASPx]
<ClientSideEvents EndCallback="OnEndCallback" BeginCallback="OnBeginCallback" CallbackError="OnCallbackError"/>
[JScript]
var command = "";
var is_error = false;
function OnBeginCallback(s, e) {
command = e.command;
is_error = false;
}
function OnEndCallback(s, e) {
if ((command == "DELETEROW" || command == "UPDATEEDIT") && (is_error == false)) {
master_grid.Refresh();
}
}
function OnCallbackError(s, e) {
is_error = true;
}