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

 

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

Namespace:   System.Web.UI.Design
Assembly:  System.Design (in System.Design.dll)

public:
ClientScriptItem(
	String^ text,
	String^ source,
	String^ language,
	String^ type,
	String^ id
)

Parameters

text
Type: System::String^

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

source
Type: System::String^

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

language
Type: System::String^

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

type
Type: System::String^

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

id
Type: System::String^

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

Exception Condition
ArgumentNullException

id is null (thrown by the design host).

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.

.NET Framework
Available since 2.0
Return to top
Show: