1 & 2 We will see the demo of the update panel
Try with this code
<form id="form1" runat="server">
<asp:ScriptManager runat="server"
ID="scriptmanager"></asp:ScriptManager>
<div>
<asp:Label ID="lbltime"
runat="server">
</asp:Label>
<asp:Timer ID="tmr" runat="server"
Interval="1000"
ontick="tmr_Tick"></asp:Timer>
</div>
</form>
protected void
tmr_Tick(object sender, EventArgs e)
{
lbltime.Text = DateTime.Now.ToString();
}
Here we display the current time in the label and
refreshing the page every time when you run this code you will see that page is
refreshing automatically and whole control initialize again
So here we stop refreshing the page and only
refresh the label without affecting the page
So we will use the update panel
3.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
//write here the code
</ContentTemplate></asp:UpdatePanel>
Just doing this you can see that the
page is not refreshing but only the control is refreshing itself
No comments:
Post a Comment