DeleteRow

Description

Deletes a row from a DataWindow.

Applies to

Web DataWindow client control

Syntax

number objdwcontrol.DeleteRow ( number row )

Argument

Description

objdwcontrol

A reference to a Web DataWindow client control.

row

A value identifying the row you want to delete. To delete the current row, specify 0 for row.

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

DeleteRow deletes the row from the DataWindow’s primary buffer.

Calling DeleteRow causes the new status of the data to be sent back to the server where data is retrieved again minus the deleted row. Then the page is reloaded. But you must still call the Update method to update the database and the data on the server.

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.

Examples

Example 1

This function in a .aspx file displays the number of the row deleted in an alert message:

function btnDeleteRow_onclick() {
   alert("DeleteRow returned: " +
   objwdw.DeleteRow(Form1.rownum.value));
}