微软自带AJAX的用法

 

首先下载一个ASPAJAXExtSetup,安装后生成的AjaxControlToolkit.dll放到ui里的bin文件夹里.接下来就可以用了.

<asp:ScriptManager ID="ScriptManagerUser" EnablePageMethods="true" runat="server" />

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>

异步刷新的内容

</ContentTemplate>

    <Triggers>

<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />        <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />

      <asp:AsyncPostBackTrigger ControlID="CheckBox1" EventName="CheckedChanged" />

    </Triggers>

</asp:UpdatePanel>

//注意ControlID是触发控件的id,而DropDownList1的触发是OnSelectedIndexChanged="dropDistrict_SelectedIndexChanged",触发后是运行cs里的dropDistrict_SelectedIndexChanged段.而CheckBox1的触发是

OnCheckedChanged="CheckBox1_CheckedChanged"触发后是运行cs里的CheckBox1_CheckedChanged段.

总结: EventName是控件的Click的一部分,Click(OnClick);

SelectedIndexChanged(OnSelectedIndexChanged);

CheckedChanged(OnCheckedChanged).

posted on 2008-03-10 14:01  秋天  阅读(456)  评论(0编辑  收藏  举报

导航