ScriptManager.ScriptResourceMapping 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.
Gets a ScriptResourceMapping object.
public:
static property System::Web::UI::ScriptResourceMapping ^ ScriptResourceMapping { System::Web::UI::ScriptResourceMapping ^ get(); };
public static System.Web.UI.ScriptResourceMapping ScriptResourceMapping { get; }
static member ScriptResourceMapping : System.Web.UI.ScriptResourceMapping
Public Shared ReadOnly Property ScriptResourceMapping As ScriptResourceMapping
Property Value
A ScriptResourceMapping object.
Examples
The following examples shows how to add a ScriptResourceDefinition object that can be referenced by a ScriptManager object. Add the following code to the Global.asax file in the Application_Start
event.
ScriptResourceDefinition myScriptResDef = new ScriptResourceDefinition();
myScriptResDef.Path = "~/Scripts/jquery-1.4.2.min.js";
myScriptResDef.DebugPath = "~/Scripts/jquery-1.4.2.js";
myScriptResDef.CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js";
myScriptResDef.CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js";
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", null, myScriptResDef);
Dim myScriptResDef As New ScriptResourceDefinition()
myScriptResDef.Path = "~/Scripts/jquery-1.4.2.min.js"
myScriptResDef.DebugPath = "~/Scripts/jquery-1.4.2.js"
myScriptResDef.CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"
myScriptResDef.CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js"
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", Nothing, myScriptResDef)
In the markup for an ASP.NET Web Forms page (.aspx file), add the following markup inside the form
element and before any elements or code that uses jQuery script.
<asp:ScriptManager ID="sm1" runat="server">
<Scripts>
<asp:ScriptReference Name="jquery"/>
</Scripts>
</asp:ScriptManager>
Remarks
The static ScriptResourceMapping property returns a ScriptResourceMapping object that can contain a collection of mappings that represent the location of the script resource (script redirection). This collection of mappings can be mapped based on names or name/assembly pairs, and it can point to a ScriptResourceDefinition object.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기