Ajax ConfirmButtonExtender

ASP.NET AJAX Control Toolkit is an open-source project built on top of the Microsoft ASP.NET AJAX framework. The Ajax Control Toolkit contains a rich set of controls that you can use to build highly responsive and interactive Ajax-enabled Web applications.

confirmationButton

The Ajax Control Toolkit contains more than 40 controls. The ConfirmButton is a simple extender that displays the confirm box with a confirmation message and OK, Cancel button also catches clicks on a button and displays a message to end user.

To use the Ajax Control Toolkit in your Visual Studio project, you should add reference to the AjaxControlToolkit.dll in your project.

Default.aspx

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <br /> <asp:Label ID="Label2" runat="server" Text=""> </asp:Label> <br /><br /> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="btnConfirm" runat="server" Text="Show Server Time" OnClick="btnConfirm_Click" /> <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnConfirm" ConfirmText="Dyou want to see current server time ?" ConfirmOnFormSubmit="false"> </asp:ConfirmButtonExtender> <br /><br /> <asp:Label ID="lblMessage" runat="server"> </asp:Label><br /> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>
Full Source | C#
using System; using System.Data; using System.Web.UI; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label2.Text = "Page Loaded Time - " + DateTime.Now.ToString(); } protected void btnConfirm_Click(object sender, EventArgs e) { lblMessage.Text = "Current Server Time - " + DateTime.Now.ToString(); } }
Full Source | VB.NET
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Label2.Text = "Page Loaded Time - " + DateTime.Now.ToString() End Sub Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConfirm.Click lblMessage.Text = "Current Server Time - " + DateTime.Now.ToString() End Sub End Class



Click the following links to see full source code

C# Source Code
VB.NET Source Code
Default.aspx.cs
Default.aspx.vb