新聞中心
在ASP.NET AJAX中,由于一個(gè)ASPX頁(yè)面上只能有一個(gè)ScriptManager控件,所以在有Master-Page的情況下,如果需要在Master-Page和Content-Page中需要引入不同的腳本時(shí),就需要在Content-page中使用ScriptManagerProxy控件,而不是ScriptManager,ScriptManagerProxy和 ScriptManager是兩個(gè)非常相似的控件。ASP.NET AJAX簡(jiǎn)單定義形式如下:

- <asp:ScriptManagerProxyidasp:ScriptManagerProxyid="ScriptManagerProxy1"runat="server">
- <asp:ServiceReferencePathasp:ServiceReferencePath="CalculWebService.asmx"/>
在它下面可以添加的子標(biāo)簽有:Services,Scripts,AuthenticationService,ProfileService
添加一個(gè)Master-Page,在它上面添加一個(gè)ScriptManager控件,并引入WebService SimpleWebService.asmx,并添加相應(yīng)的HTML元素:
- <asp:ScriptManagerIDasp:ScriptManagerID="ScriptManager1"runat="server">
- <asp:ServiceReferencePathasp:ServiceReferencePath=
"SimpleWebService.asmx"/>- <asp:contentplaceholderidasp:contentplaceholderid=
"ContentPlaceHolder1"runat="server">- 請(qǐng)輸入名稱:
- <inputidinputid="inputName"type="text"/>
- <inputidinputid="button"type="button"value="確定"onclick=
"returnOnbuttonGo_click()"/>
添加一個(gè)Content-Page,在它上面添加一個(gè)ScriptManagerProxy控件,并引入WebService CalculWebService.asmx,并添加相應(yīng)的HTML元素:
- <asp:ScriptManagerProxyidasp:ScriptManagerProxyid=
"ScriptManagerProxy1"runat="server">- <asp:ServiceReferencePathasp:ServiceReferencePath=
"CalculWebService.asmx"/>- 請(qǐng)輸入兩個(gè)數(shù): <inputidinputid="inputA"type=
"text"style="width:110px"/> +- <inputidinputid="inputB"style="width:110px"type="text"/>
- <inputidinputid="buttonEqual"type="button"value="="onclick=
"returnOnbuttonEqual_click()"/>
關(guān)于ASP.NET AJAX中ScriptManagerProxy控件就介紹到這兒,有個(gè)問(wèn)題就是在我的IDE中為什么ScriptManagerProxy總是提示為未知元素,但運(yùn)行起來(lái)并不抱錯(cuò),結(jié)果也可以出來(lái)?
【編輯推薦】
- 介紹ASP.NET MVC框架
- 淺談ASP.NET MVC的MvcContrib.FluentHtml
- ASP.NET框架的功能與ASP.NET MVC模式的應(yīng)用介紹
- 淺析Asp.net MVC生命周期
- 配置ASP.NET AJAX概述
網(wǎng)頁(yè)題目:ASP.NET AJAX中ScriptManager控件
URL分享:http://fisionsoft.com.cn/article/djoijhh.html


咨詢
建站咨詢
