页面部分
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<h2>
使用VS控件updatePanel实现无刷新
</h2>
<p>
<asp:UpdatePanel ID="UpdatePanel1" RenderMode="Block" UpdateMode="Conditional" runat="server">
<ContentTemplate>
点击按钮从服务器获取当前时间<asp:TextBox ID="txtTime" runat="server"></asp:TextBox>
<asp:Button ID="btn1" runat="server" Text="Button" onclick="btn1_Click" />
</ContentTemplate>
<Triggers>
<%--<asp:PostBackTrigger ControlID="btn1" />--%>
<asp:AsyncPostBackTrigger ControlID="btn1"/>
</Triggers>
</asp:UpdatePanel>
</p>
后台代码
protected void btn1_Click(object sender, EventArgs e)
{
txtTime.Text = DateTime.Now.ToString();
}