頁(yè)面部分
代碼如下:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<h2>
使用VS控件updatePanel實(shí)現(xiàn)無(wú)刷新
</h2>
<p>
<asp:UpdatePanel ID="UpdatePanel1" RenderMode="Block" UpdateMode="Conditional" runat="server">
<ContentTemplate>
點(diǎn)擊按鈕從服務(wù)器獲取當(dāng)前時(shí)間<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>
后臺(tái)代碼
代碼如下:
protected void btn1_Click(object sender, EventArgs e)
{
txtTime.Text = DateTime.Now.ToString();
}
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com