Update

Description

Updates the database with the changes made in a Web DataWindow client control. Update can also call AcceptText for the current row and column before it updates the database.

Applies to

Web DataWindow client control

Syntax

number objdwcontrol.Update ( ) 

Argument

Description

objdwcontrol

A reference to a Web DataWindow client control.

Returns

Returns -1 if AcceptText fails and 1 otherwise. AcceptText is called for all methods that reload the page before sending data to the server.

Usage

Calling Update in the client control causes changed data to be passed to the server and updated there. Data is retrieved again and the page is reloaded. Data is not committed or rolled back automatically after the client-side Update action is performed.

The Transaction and AdoTransaction objects are programmable, and you should perform transaction management yourself in the AfterPerformAction server-side event or elsewhere.

All methods that reload the page perform an AcceptText before sending data back to the server. If the method fails (returns -1), this means that pending data changes were not accepted and nothing was sent back to the server. Use the server-side AfterPerformAction event to detect and handle the failure appropriately.

The AfterPerformAction event handler receives an argument of type AfterPerformActionEventArgs that contains an Action property that indicates the client DataWindow postback action, and an ActionResult property that contains the value 1 for success or -1 for failure.

Frequent updating improves performance The Web DataWindow client maintains the state of the server component in string form and the information is sent to the server and back again with every request. If the user has not modified the data, the amount of client-side state information is small. The amount of client-side state information grows proportionally to the number of outstanding changes that have not been updated to the database. When the client control calls Update or server-side code calls the UpdateData method, the state information returns to the minimum amount, so calling Update or UpdateData frequently can reduce the amount of information transferred back and forth.

Examples

Example 1

function btnUpdate_onclick() {
	alert("Update returned: " + objwdw.Update());
}