ScriptResourceAttribute.ScriptResourceName Propriedade
Definição
Cuidado
This property is obsolete. Use StringResourceName instead.
Obtém o nome do arquivo de recurso da biblioteca de script.Gets the name of the resource file for the script library.
public:
property System::String ^ ScriptResourceName { System::String ^ get(); };
public string ScriptResourceName { get; }
[System.Obsolete("This property is obsolete. Use StringResourceName instead.")]
public string ScriptResourceName { get; }
member this.ScriptResourceName : string
[<System.Obsolete("This property is obsolete. Use StringResourceName instead.")>]
member this.ScriptResourceName : string
Public ReadOnly Property ScriptResourceName As String
Valor da propriedade
O nome do arquivo de recurso da biblioteca de script.The name of the resource file for the script library.
- Atributos
Exemplos
O exemplo a seguir mostra um ScriptResourceAttribute atributo para um arquivo de script chamado CheckAnswer.js que usa recursos dos arquivos de recurso VerificationResources.The following example shows a ScriptResourceAttribute attribute for a script file named CheckAnswer.js that uses resources from the VerificationResources resource files. O nome Answer é usado para fazer referência a esses recursos.The name Answer is used to reference these resources. Neste exemplo, a ScriptResourceName propriedade retorna "LocalizingResources. VerificationResources".In this example, the ScriptResourceName property returns "LocalizingResources.VerificationResources". A extensão de nome de arquivo não é incluída quando você define o ScriptResourceName .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")]
<Assembly: System.Web.UI.WebResource("LocalizingScriptResources.CheckAnswer.js", "application/x-javascript")>
<Assembly: System.Web.UI.ScriptResource("LocalizingScriptResources.CheckAnswer.js", "LocalizingScriptResources.VerificationResources", "Answer")>
O exemplo a seguir mostra como usar os recursos no script de cliente.The following example shows how to use the resources in client script. As chaves de recurso ( Correct e Incorrect ) são prefixadas com Answer para identificar a definição de recurso de script que contém os valores.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;
}
}