Muokkaa

Jaa


ClientScriptItem(String, String, String, String, String) Constructor

Definition

Initializes a new instance of the ClientScriptItem class using the provided parameters.

public:
 ClientScriptItem(System::String ^ text, System::String ^ source, System::String ^ language, System::String ^ type, System::String ^ id);
public ClientScriptItem (string text, string source, string language, string type, string id);
new System.Web.UI.Design.ClientScriptItem : string * string * string * string * string -> System.Web.UI.Design.ClientScriptItem
Public Sub New (text As String, source As String, language As String, type As String, id As String)

Parameters

text
String

The contents for the script element; a string of script statements to run on the client.

source
String

The src attribute value for the script element, specifying an external source location for the client script contents.

language
String

The language attribute value for the script element, specifying the language of the script statements.

type
String

The type attribute value for the script element, indicating the MIME type for the associated scripting engine.

id
String

The ID for the script element. This argument is required by the design host (for example, Visual Studio 2005).

Exceptions

id is null (thrown by the design host).

Remarks

Initialize the statements for the ClientScriptItem object by using either the text or source parameter (not both). Use text to initialize the script using an input string that contains the statements. Alternately, use source to initialize a script using a path that contains the script statements.

You can specify any of the input parameters as null or an empty string (""); the corresponding property is set using the input value, and the script element is generated without that property. Using null or an empty string ("") generates the following results:

  • For text, the corresponding script element does not contain script statements.

  • For source, the src attribute is not set in the script element.

  • For language, the language attribute is not set in the script element.

    When a client script block does not specify the script language, the client browser determines the language.

  • For type, the type attribute is not set in the script element.

    When a client script block does not specify the script type, the client browser determines the type.

  • For id, the design host (for example, Visual Studio 2005) will throw an ArgumentNullException.

Applies to

See also