<form id="form1?" runat="server">
<asp:ScriptManager ID="ScriptManager1?" runat="server" />
<div>
Page Generated @
<asp:Label runat="server" ID="uiPageTime" />
<p />
<asp:UpdatePanel runat="server" ID="update" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label runat="server" ID="uiTime" />
<asp:Button runat="server" ID="uiInternalButton" Text="Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="uiAsynch" EventName="click" />
<asp:PostBackTrigger ControlID="uiInternalButton" />
</Triggers>
</asp:UpdatePanel>
<asp:Button runat="server" ID="uiPostback" Text="Click" />
<asp:Button runat="server" ID="uiAsynch" Text="Asynch" />
</div>
</form>
And the code behind file. <asp:ScriptManager ID="ScriptManager1?" runat="server" />
<div>
Page Generated @
<asp:Label runat="server" ID="uiPageTime" />
<p />
<asp:UpdatePanel runat="server" ID="update" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label runat="server" ID="uiTime" />
<asp:Button runat="server" ID="uiInternalButton" Text="Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="uiAsynch" EventName="click" />
<asp:PostBackTrigger ControlID="uiInternalButton" />
</Triggers>
</asp:UpdatePanel>
<asp:Button runat="server" ID="uiPostback" Text="Click" />
<asp:Button runat="server" ID="uiAsynch" Text="Asynch" />
</div>
</form>
public partial class _Default : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
uiAsynch.Click += uiAsynch_Click; uiPostback.Click += uiPostback_Click;
uiInternalButton.Click += uiInternalButton_Click;
}
protected void Page_Load(object sender, EventArgs e)
{
uiPageTime.Text = DateTime.Now.ToLongTimeString();
if (!IsPostBack)
{
uiTime.Text = DateTime.Now.ToLongTimeString();
}
}
private void uiInternalButton_Click(object sender, EventArgs e)
{
uiTime.Text = "Internal @ " + DateTime.Now.ToLongTimeString();
}
private void uiPostback_Click(object sender, EventArgs e)
{
uiTime.Text = "Postback click @ " + DateTime.Now.ToLongTimeString();
update.Update();
}
private void uiAsynch_Click(object sender, EventArgs e)
{
uiTime.Text = "Asych click @ " + DateTime.Now.ToLongTimeString();
update.Update();
}
}
{
protected void Page_Init(object sender, EventArgs e)
{
uiAsynch.Click += uiAsynch_Click; uiPostback.Click += uiPostback_Click;
uiInternalButton.Click += uiInternalButton_Click;
}
protected void Page_Load(object sender, EventArgs e)
{
uiPageTime.Text = DateTime.Now.ToLongTimeString();
if (!IsPostBack)
{
uiTime.Text = DateTime.Now.ToLongTimeString();
}
}
private void uiInternalButton_Click(object sender, EventArgs e)
{
uiTime.Text = "Internal @ " + DateTime.Now.ToLongTimeString();
}
private void uiPostback_Click(object sender, EventArgs e)
{
uiTime.Text = "Postback click @ " + DateTime.Now.ToLongTimeString();
update.Update();
}
private void uiAsynch_Click(object sender, EventArgs e)
{
uiTime.Text = "Asych click @ " + DateTime.Now.ToLongTimeString();
update.Update();
}
}
No comments:
Post a Comment