什么是脚本管理器控件实际上呢? [英] What does script manager control actually do?

查看:152
本文介绍了什么是脚本管理器控件实际上呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小疑问,我不能谷歌的答案,所以以为我可以在这里找到答案。
我们为什么要添加

I have a small doubt which I could not google the answer, So thought I could find the answer here. Why should we add

 <asp:ScriptManager ID="ScriptManager1" runat="server">
 </asp:ScriptManager>

为了控制使用

  <asp:UpdatePanel runat="server"> in out aspx page.

希望有人能给出答案。

hope some one can give the answer.

先谢谢了。

推荐答案

ScriptManager控件注册的页面为Microsoft AJAX库脚本。这使得客户端脚本支持功能,如局部页面呈现和Web服务调用。

ScriptManager control registers the script for the Microsoft AJAX Library with the page. This enables client script support features such as partial-page rendering and Web-service calls.

您必须使用一个页面上的ScriptManager控件使ASP.NET AJAX的以下特点:

You must use a ScriptManager control on a page to enable the following features of ASP.NET AJAX:

1。在Microsoft AJAX库的客户端脚本功能,并要发送到浏览器的任何自定义脚本。

protected void Button1_Click(object sender, EventArgs e)
{
    Page.ClientScript.RegisterStartupScript(
        this.GetType(),"myscript","alert('hello world!');");
}

2。局部页面呈现,使页面上的地区独立刷新不回发。在ASP.NET AJAX的UpdatePanel,的UpdateProgress,和Timer控件需要ScriptManager控件来支持局部页面呈现。

3。 JavaScript代理类的Web服务,从而使您可以使用客户端脚本通过将Web服务作为强类型对象来访问Web服务。

[WebMethod]
public int Add(int a, int b) { return a + b; }

function CallAdd()
{
    // method will return immediately
    // processing done asynchronously
    WebService.Add(0,6, OnMethodSucceeded, OnMethodFailed);
}

4。 JavaScript类访问ASP.NET验证和配置文件应用程序服务。

Sys.Services.AuthenticationService.login
Sys.Services.AuthenticationService.logout

<script type="text/javascript">
    function MyMethod(username, password)
    {
        Sys.Services.AuthenticationService.login(username,
            password,false,null,null,null,null,"User Context"); 
    }
</script>

多见于<一个href=\"http://msdn.microsoft.com/en-us/magazine/cc163354.aspx\">http://msdn.microsoft.com/en-us/magazine/cc163354.aspx

这篇关于什么是脚本管理器控件实际上呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆