Controlling what is generated

Disabling features of the client control

SetWeight Although the server component generates a considerable amount of HTML or XHTML and JavaScript for the Web DataWindow client control, it is still no more than an average image file. However, to reduce the size of the control on the client, you can instruct the component to leave out code for features you are not using. You can tell the component to omit code for:

You can disable any of these on the Web Generation property page in the DataWindow painter or with the SetWeight method. False for a particular argument means no code for that feature is generated.

This statement enables all features:

dwGen.SetWeight(true, true, true, true, true);

If updating of data is false, no validation or display formatting code is generated either. In this statement, it does not matter what the second and fifth arguments are, because the first argument for updating data is false:

dwGen.SetWeight(false, false, true, true, false);

This statement turns off the client-side scripting capability:

dwGen.SetWeight(true, true, true, false, true);

Updating data and display formatting add the most code to the client-side control. Date processing also generates additional code. For the smallest client control, turn on only the features you need and make sure your DataWindow object does not have any date columns.

Naming the client control

SetHTMLObjectName You need to provide a name for the Web DataWindow client control. The name is used for page parameters and client-side events. If there is more than one Web DataWindow client control on the Web page, each needs a unique name.

This code uses the same name for the server component variable and the client control:

	dwGen.SetHTMLObjectName ("dw_1");

NoteXML Web DataWindow If you are using an XML Web DataWindow with a custom XHTML template, the object name in the template must match the name of the client control (dw_1 in the example).

Optimizing HTML for a browser

SetBrowser The Web DataWindow can generate HTML optimized for particular browsers and versions. In particular, it can generate code for Microsoft and Netscape browsers. The browser might be different each time the server component is instantiated by a different client, so this information cannot be preset in the DataWindow painter. You can tell it what browser and version to target in the server-side script. In the painter, you can set the HTML Version property to specify what level of HTML to generate if the browser is not recognized.

For information on what HTML features the DataWindow uses for different browsers, see the DataWindow Reference or the HTMLGen.property topic in online Help.

At runtime, the HTTP header sent from the client browser to the Web server contains the User-Agent or HTTP_USER_AGENT value, which the server component can use to identify the client browser.