Passing user actions to the server component

SetAction When the user clicks a DataWindow button, action information is passed back to the page server as context and action page parameters. Your server-side script needs to access those page parameters and call SetAction so the server component can apply the action to the generated HTML.

The names of the parameters use the object name specified in the SetHTMLObjectName method, for example: dw_1_action and dw_1_context. You can also specify the object name on the Web Generation tab page in the DataWindow painter.

You can include buttons for scrolling to other pages of data and for retrieving and updating data and inserting and deleting rows. When these button actions occur, the change is sent back to the server component and the change is made in the DataWindow buffer. If the user clicks an update button, the update method is called in the component without any other scripting needed.

NoteNo need to call methods You can call server component methods directly for retrieving data, updating, inserting and deleting rows, and so forth. However, remember that button clicks invoke the actions. You do not need to call the methods too.

This code checks whether parameters have been defined (meaning that the page is a reloaded page) and if so, calls SetAction to send the action information to the server component:

int retVal;
String dw_1_action =(String)request.GetParameter     ("dw_1_action");
String dw_1_context = (String)request.GetParameter     ("dw_1_context");
if (dw_1_context == null){
	dw_1_context = " ";
}
// Check if we need to perform the action
if (dw_1_action!=null){
  retVal = dwGen.SetAction(dw_1_action, dw_1_context);
  if (retVal < 0 ) {
	out.print("Error on SetAction: "			+ retVal + "<BR>");
	out.print(dwGen.GetLastErrorString()+ "<BR>");
  }
}