ScriptManager.ScriptResourceMapping Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene un ScriptResourceMapping oggetto .
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
Valore della proprietà
Un oggetto ScriptResourceMapping.
Esempio
Negli esempi seguenti viene illustrato come aggiungere un ScriptResourceDefinition oggetto a cui può fare riferimento un ScriptManager oggetto . Aggiungere il codice seguente al file Global.asax nell'evento 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)
Nel markup per una pagina web Form ASP.NET (file .aspx), aggiungere il markup seguente all'interno dell'elemento form e prima di qualsiasi elemento o codice che usa lo script jQuery.
<asp:ScriptManager ID="sm1" runat="server">
<Scripts>
<asp:ScriptReference Name="jquery"/>
</Scripts>
</asp:ScriptManager>
Commenti
La proprietà statica ScriptResourceMapping restituisce un ScriptResourceMapping oggetto che può contenere una raccolta di mapping che rappresentano la posizione della risorsa script (reindirizzamento script). Questa raccolta di mapping può essere mappata in base ai nomi o alle coppie nome/assembly e può puntare a un ScriptResourceDefinition oggetto .