This documentation is archived and is not being maintained.

ScriptResourceAttribute Class

Defines a resource in an assembly to be used from a client script file. This class cannot be inherited.

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

No code example is currently available or this language may not be supported.

The ScriptResourceAttribute class is valid only when you use it in assembly declarations. You use it to enable a specified embedded script resource in an assembly. You can define the name of the embedded script library, the name of the resource file for the script library, and the name that is used in a script file for retrieving the resource values. The ScriptManager class uses the properties in ScriptResourceAttribute to determine the correct resource name for a script library. The TypeName property is used with a resource key to specify a resource.

The following example shows a ScriptResourceAttribute attribute for a script file named CheckAnswer.js that uses resources from the VerificationResources resource files. The name Answer is used to reference these resources.

No code example is currently available or this language may not be supported.

The following example shows how to use the resources in client script. The resource keys (Correct and Incorrect) are prefixed with Answer to identify the script resource definition that contains the values.

No code example is currently available or this language may not be supported.

System.Object
  System.Attribute
    System.Web.UI.ScriptResourceAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Show: