Condividi tramite


ASP.NET Web Server Controls that Use Client Script

Some ASP.NET server controls depend on client script for their functionality. In addition, some functionality of ASP.NET pages relies on client script. It is useful to know how ASP.NET controls and pages use client script so that you understand how ASP.NET Web pages might be affected by differences in how browsers support client script.

Element List

The following table lists controls and control members that take advantage of client script, and what functionality is provided by the client script.

Control

Client script functionality

Page, HtmlForm, Panel

The following properties require client script:

UpdatePanel

Client script is used for partial-page rendering (asynchronous postbacks) and is an integral part of the functionality of this control.

UpdateProgress

Client script is used to display status to users while an asynchronous postback request is pending, and is an integral part of the functionality of this control.

ScriptManager

This control manages client script files and loads the Microsoft AJAX Library.

Timer

Client script is used to perform postback events from the browser at defined intervals.

LinkButton, ImageButton, and HtmlButton

Note

This does not include the Button control, the HtmlInputButton control, or the HtmlInputImage control, which do not require client script.

Client script is used to support postback events.

Calendar

This control uses LinkButton controls to implement day, week, and month navigation; the LinkButton control uses client script for postback events. If you use the Calendar control to display a single month without selection or navigation, the control does not require client script.

DetailsView

If the control includes buttons configured as LinkButton controls (for editing, paging, and so on), those functions require client script.

Client script can be used to paginate if the associated data source control supports this functionality.

If the EnablePagingCallbacks property is true, client script is used to manage the callback.

GridView

If the control includes buttons configured as LinkButton controls (for editing, paging, and so on), those functions require client script.

Client script can be used to sort and paginate if the associated data source control supports this functionality.

If the EnableSortingAndPagingCallbacks property is true, client script is used to manage the callback.

Label

The AssociatedControlID property, together with the AccessKey property, generates client script to set the focus on the appropriate control in response to a keyboard shortcut. If these properties are not set, client script is not required for this control.

Menu

Client script is used to open and close menu items, display pop-out panels, and control the display when users position the mouse pointer over menu items.

TreeView

Client script is used to open and close nodes. It is also used when the TreeView control is configured to populate nodes on demand.

Client script can be disabled for the TreeView control, in which case the selection behavior is performed in server code after a postback. However, the nodes themselves are rendered as links that use client script to perform a postback. Therefore, if the browser does not support client script, the TreeView cannot perform a postback.

Any Web server control with its AutoPostBack property set to true.

The AutoPostBack property behavior for non-button controls is implemented by using client script.

Web Parts controls

Client script is used to support drag-and-drop behavior, adding Web Parts controls to zones, verbs, and import and export functionality.

Validator controls:

Client script is used to provide immediate validation feedback. If the client does not support script, validation will run on the server only.

Any methods or properties that set focus on controls, such as the Focus method on controls and the page's SetFocus method.

Client script is used to set focus on the specified control.

The client script required for these controls and members is automatically generated and sent as part of the page. It is compatible with all browsers that support ECMAScript (JScript, JavaScript) — that is, it does not depend on the advanced scripting capabilities of dynamic HTML (DHTML). An exception is the Web Parts control set, which requires Microsoft Internet Explorer version 5.5 or later to implement full capabilities.

Note

Some validation features can take advantage of DHTML if it is available in the browser, but DHMTL is not required.

Users sometimes disable script in a browser as a security measure. If they have done this, the functionality provided by client script is lost. This completely disables some controls, such as the LinkButton control, and it disables the functionality of the AutoPostBack property. Validation is only partially affected—validation is still performed on the server, but users do not receive the immediacy of client-based validation.

See Also

Concepts

Client Script in ASP.NET Web Pages

Tab Order, Focus, and Access Keys in ASP.NET Web Server Controls