Export (0) Print
Expand All

ScriptResourceAttribute.ScriptResourceName Property

Note: This API is now obsolete.

Gets the name of the resource file for the script library.

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

[ObsoleteAttribute("This property is obsolete. Use StringResourceName instead.")]
public string ScriptResourceName { get; }

Property Value

Type: System.String
The name of the resource file for the script library.

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. In this example, the ScriptResourceName property returns "LocalizingResources.VerificationResources". The file name extension is not included when you define the ScriptResourceName.

[assembly: System.Web.UI.WebResource("LocalizingScriptResources.CheckAnswer.js", "application/x-javascript")]
[assembly: System.Web.UI.ScriptResource("LocalizingScriptResources.CheckAnswer.js", "LocalizingScriptResources.VerificationResources", "Answer")]

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.

function CheckAnswer()
{
    var firstInt = $get('firstNumber').innerText;
    var secondInt = $get('secondNumber').innerText;
    var userAnswer = $get('userAnswer');

    if ((Number.parseLocale(firstInt) + Number.parseLocale(secondInt)) == userAnswer.value)
    {
        alert(Answer.Correct);
        return true;
    }
    else
    {
        alert(Answer.Incorrect);
        return false;
    }
}

.NET Framework

Supported in: 3.5
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2
Obsolete (compiler warning) in 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft