Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

TypeName Property

Gets the name that is used when retrieving the values in the resource file.

Syntax

CSharp

public string TypeName { get; }

VisualBasic

Public ReadOnly Property TypeName As String

ManagedCPlusPlus

public:
String^ TypeName {
	String^ get ();
}

JSharp

/** @property */

Value

Return Value

The name that is used in client script when retrieving the values in the resource file.

Remarks

The TypeName property contains the value that is used for retrieving localized resources in client script. The client script must include the TypeName value and the key name for the resource to be localized.

Examples

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 TypeName property returns "Answer".

cs

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

vb

<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.

cs

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;
    }
}

vb

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;
    }
}

Assembly: System.Web.Extensions (Module: System.Web.Extensions)