ScriptResourceAttribute.ScriptResourceName Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
This property is obsolete. Use StringResourceName instead.
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
Property Value
The name of the resource file for the script library.
- Attributes
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 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")]
<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;
}
}
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應