InsertRow

Description

Inserts a row in a Web DataWindow client control. If any columns have default values, the row is initialized with these values before it is displayed.

Applies to

Web DataWindow client control

Syntax

number objdwcontrol.InsertRow ( number row ) 

Argument

Description

objdwcontrol

A reference to a Web DataWindow client control.

row

A value identifying the row before which you want to insert a row. To insert a row at the end, specify 0.

Returns

Returns -1 if AcceptText fails and otherwise returns the number of the row that was added. AcceptText is called for all methods that reload the page before sending data to the server.

Usage

Calling InsertRow causes the new status of the data to be sent back to the server where the data is retrieved again and the row is inserted. Then the page is reloaded.

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 inserted in an alert message:

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