The
OnClientPopulateControls event is executed when the controls used for add/edit are populated with data.
This event can be used to set default values for the newly added record, or to modify the existing data
that will be loaded into the controls for edit.
The event has two arguments: an object containing all the data which will be used to populate the controls
and a string paramter indicating whether an add or edit action takes place.
The function must return the object containing the modified data - this data
will be loaded into the controls for add/edit.
function onClientPopulateControls(record, type) {
if(type == "add") {
// default values for add
record.ShipName = "Default Name";
record.ShipCity = "Default City";
record.ShipCountry = "Default Country";
} else {
// apply changes to the values for the edit controls
if(record.ShipCountry == "") {
record.ShipCountry = "USA";
}
}
return record;
}