Visual InterDev

Button Design-Time Control

See Also      Tasks      Properties

Creates a Button script object, which creates an intrinsic HTML button.

Remarks

You can set the properties of the Button control at design time using the Properties window and the Button Properties dialog box.

Note   Button controls cannot be bound to data.

Button controls support either image or text to be displayed on the button. Use the Caption property to display text. To display an image, set the Image property to the URL of an image. Use the AltText property to specify text that is displayed while the image loads or if it fails to load.

Note   The scripting platform specifies where an object's script is run - either on the client (Microsoft® Internet Explorer 4.0 DHTML) or on the server (ASP). Thus, the scripting platform determines whether the object is available under Client Objects & Events or Server Objects & Events in the Script Outline window.

For the Button control, the Scripting Platform property is specified on the General tab of the Button Properties dialog box. For more information, see the DTCScriptingPlatform property. For detailed information about choosing a scripting platform, see Writing Script for Script Objects.

Scripting Notes

To control how the button is displayed, call the hide, show, and isVisible methods. For more information about the run-time object, see Button Script Object.

Tip   When the scripting platform is set to server (ASP), use a server-side onclick event to call an event handler. When a user clicks the button, the page is submitted to the server where the onclick event is processed.

After you add a Button control to your page, you can add script to your page that is run when the button is pressed.

To add script for a Button control

  1. Drag a Button control from the Toolbox onto a page.

  2. On the View menu, select Other Windows and then Script Outline.

  3. For scripting on the server (ASP), expand Server Object and Events.

    For scripting on the client (Internet Explorer 4.0 DHTML), expand Client Object and Events.

  4. Expand the object that corresponds to the name of your button.

  5. Double-click the onclick event. (Note the lightning bolt icon that signifies an event).

    Visual InterDev pastes the stub of an event handler for the onclick event onto your page. You can now write your script for this event handler.

For more information about the run-time object, see Button Script Object. For more information on scripting and objects, see Scripting with Design-Time Controls and Script Objects.