首先下載一個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).