ScriptManager.ScriptResourceMapping Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
ScriptResourceMapping Mendapatkan objek.
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
Nilai Properti
Objek ScriptResourceMapping.
Contoh
Contoh berikut menunjukkan cara menambahkan ScriptResourceDefinition objek yang dapat dirujuk oleh ScriptManager objek. Tambahkan kode berikut ke file Global.asax dalam peristiwa tersebut Application_Start .
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)
Di markup untuk halaman ASP.NET Web Forms (file .aspx), tambahkan markup berikut di dalam form elemen dan sebelum elemen atau kode apa pun yang menggunakan skrip jQuery.
<asp:ScriptManager ID="sm1" runat="server">
<Scripts>
<asp:ScriptReference Name="jquery"/>
</Scripts>
</asp:ScriptManager>
Keterangan
Properti statis ScriptResourceMapping mengembalikan ScriptResourceMapping objek yang dapat berisi kumpulan pemetaan yang mewakili lokasi sumber daya skrip (pengalihan skrip). Kumpulan pemetaan ini dapat dipetakan berdasarkan nama atau pasangan nama/rakitan, dan dapat menunjuk ke ScriptResourceDefinition objek.