ASP.NET中的ScriptManager控件
ScriptManager控件包括在ASP.NET 2.0 AJAX Extensions中,它用來處理頁面上的所有組件以及頁面局部更新,生成相關(guān)的客戶端代理腳本以便能夠在JavaScript中訪問Web Service,所有需要支持ASP.NET AJAX的ASP.NET頁面上有且只能有一個(gè)ScriptManager控件。在ScriptManager控件中我們可以指定需要的腳本庫,或者指定通過JS來調(diào)用的Web Service,還可以指定頁面錯(cuò)誤處理等。
使用<asp:ScriptManager/>來定義一個(gè)ScriptManager,簡(jiǎn)單的ScriptManager定義形式:
- <asp:ScriptManagerIDasp:ScriptManagerID="ScriptManager1"
- runat="server">
- <AuthenticationServicePathAuthenticationServicePath=""/>
- <ProfileServiceLoadPropertiesProfileServiceLoadProperties=""Path=""/>
- <Scripts>
- <asp:ScriptReference/>
- </Scripts>
- <Services>
- <asp:ServiceReference/>
- </Services>
- </asp:ScriptManager>
Scripts屬性
最主要的屬性有Path指定腳本的路徑,ScriptMode指定客戶端腳本的模式,它會(huì)覆蓋ScriptManager中的ScriptMode屬性,還有一個(gè)屬性是IgnoreScriptPath,指定是否忽略掉ScriptManager中的ScriptPath屬性。
關(guān)于ScriptManager控件就學(xué)習(xí)到這里了,至于AuthenticationService屬性和ProfileService屬性都很簡(jiǎn)單。
【編輯推薦】