*************************************************************************
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!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 runat="server">
<title>ConfirmButton Extender example in Asp.Net c#</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<h2> ConfirmButton Extender example</h2>
<p>
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
</p>
<p>
<asp:Button ID="Button1" runat="server" Text="Click Me"
onclick="Button1_Click"/>
<cc1:ConfirmButtonExtender
ID="Button1_ConfirmButtonExtender"
runat="server"
ConfirmText="Are you sure? You want to run the server code."
OnClientCancel="onCancel"
ConfirmOnFormSubmit="false"
Enabled="True"
TargetControlID="Button1">
</cc1:ConfirmButtonExtender>
</p>
</div>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
function onCancel()
{
var lblMsg = $get('<%=lblMessage.ClientID%>');
lblMsg.innerHTML = "You clicked the <b>Cancel</b> button of AJAX confirm.";
}
</script>
*************************************************************************
using System;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
lblMessage.Text = "You clicked the <b>OK</b> button of AJAX confirm";
}
}
No comments:
Post a Comment