ScriptManager的主要职责是向浏览器发布脚本,如果使用一个javascript脚本,就可以这样注册一下:

<asp:ScriptManager ID="ScriptManager1" runat="server">
 
<Scripts>
  
<asp:ScriptReference Path="~/scripts/Script1.js" />
  
<asp:ScriptReference Path="~/scripts/Script1.js" />
 
</Scripts>
</asp:ScriptManager>

 另外一个功能是用来注册服务,

<asp:ScriptManager ID="ScriptManager1" runat="server">
 
<Services>
  
<asp:ServiceReference Path="~/Services/MainService.asmx " />
  
</Services>
</asp:ScriptManager>

 还可以进行本地化操作,例如脚本文件是面向法语的可以命名为:SampleScript.fr-FR.js,然后将ScriptManager的EnableScriptLocalization属性设置位True,ScriptManager就会获得对性的脚本文件。

一个页面仅能有一个ScriptManager控件,如果要在一个单独页面单独引入一个js文件可以用ScriptManagerProxy控件。

 

posted on 2009-01-07 22:38  Tiu  阅读(261)  评论(0编辑  收藏  举报