Aracılığıyla paylaş


ScriptManager.ScriptResourceMapping Özellik

Tanım

Bir ScriptResourceMapping nesnesi alır.

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

Özellik Değeri

Bir ScriptResourceMapping nesnesi.

Örnekler

Aşağıdaki örneklerde, bir nesne tarafından başvurulabilecek bir ScriptResourceDefinitionScriptManager nesnenin nasıl ekleneceği gösterilmektedir. Olayda Global.asax dosyasına Application_Start aşağıdaki kodu ekleyin.

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)

bir ASP.NET Web Forms sayfasının (.aspx dosyası) işaretlemesinde, öğesinin form içine ve jQuery betiği kullanan öğelerin veya kodların önüne aşağıdaki işaretlemeyi ekleyin.

<asp:ScriptManager ID="sm1" runat="server">
  <Scripts>
    <asp:ScriptReference Name="jquery"/>
  </Scripts>
</asp:ScriptManager>

Açıklamalar

Statik ScriptResourceMapping özellik, betik kaynağının konumunu (betik yeniden yönlendirme) temsil eden bir eşleme koleksiyonu içerebilen bir nesne döndürür ScriptResourceMapping . Bu eşleme koleksiyonu adlara veya ad/derleme çiftlerine göre eşlenebilir ve bir ScriptResourceDefinition nesneye işaret edebilir.

Şunlara uygulanır