共用方式為


ScriptManager.EnablePageMethods 屬性

定義

取得或設定值,該值表示是否可以從用戶端指令碼呼叫 ASP.NET 網頁中的公用靜態網頁方法。

public:
 property bool EnablePageMethods { bool get(); void set(bool value); };
public bool EnablePageMethods { get; set; }
member this.EnablePageMethods : bool with get, set
Public Property EnablePageMethods As Boolean

屬性值

Boolean

如果可以從用戶端指令碼將 ASP.NET 網頁上的靜態網頁方法呼叫為 Web 方法,則為 true,否則為 false。 預設為 false

備註

您可以將靜態頁面方法新增至 ASP.NET 網頁,並將其標示為 Web 方法。 然後,您可以從腳本呼叫這些方法,就像它們是 Web 服務的一部分,但不需要建立個別的 .asmx 檔案。 若要在頁面上建立 Web 方法,請匯入命名空間, System.Web.Services 並將屬性新增 WebMethodAttribute 至您想要公開的每個靜態方法。 方法必須標示為公用。

如需詳細資訊,請參閱在 AJAX ASP.NET 公開 Web 服務至用戶端腳本

適用於