如何往自己的网站增加Asp.net Ajax

1.Web.config的更改
建议新建一个Asp.net Ajax的Web项目
然后拷贝过来更改,最早一只用别人的Web.config会出错.
发现是没有安装Asp.net Ajax Toolkit

2.用一个UpdatePanel来括住可能需要更新的内容
  需要更新内容放在<ContentTemplate></ContentTemplate>里面

  如果一个页面中存在多个UpdatePanel,又需要可能需要互相影响UpdateMode--可以不是全部更新
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
这样更新就是部分的更新

3.Trigger里面的AsyncPostBackTrigger
<asp:AsyncPostBackTrigger ControlID="btnInquire" />
可以有ControlID或者EventName
可以指定多个

4.UpdateProgress 用于提交请求的时候出现的提示信息
             <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                    <ProgressTemplate>
                        <div style="background-color: Yellow; color: Red; font-size: smaller">
                            Submiting your request......</div>
                    </ProgressTemplate>
                </asp:UpdateProgress>
如果需要根据某个UpdatePanel更新的时候出现,可以指定AssociatedUpdatePanelID
<asp:UpdateProgress ID="LoginUpdateProgress" AssociatedUpdatePanelID="LoginUpdatePanel"
    runat="server">
    <ProgressTemplate>
        <div style="background-color: Yellow; color: Red; font-size: smaller">
            Logining for you......</div>
    </ProgressTemplate>
</asp:UpdateProgress>
5.发布到虚拟机,可以拷贝
Asp.net Ajax的安装目录的Script都拷贝到根目录下
然后ScriptManager的 <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptPath="MicrosoftAjaxLibrary">
        </asp:ScriptManager>
一般把ScriptManager放到MasterPage中
6.
Page.ClientScript.RegisterClientScriptBlock在UpdatePanel存在的情况下不能生效
替换方法
System.Web.UI.ScriptManager.RegisterClientScriptBlock---Asp.net Ajax中的一个类
还好我大部分都是MasterPage笼罩下的,霍霍,全部替换.应该是木有问题.

霍霍,一个下午只有这几点
posted @ 2007-02-08 17:31  深渊野鱼  阅读(530)  评论(0编辑  收藏  举报