Introduction :
It is used to reconfirm the users action. For example in some forms if user is clicking on delete / submit button a reconfirmation dialogue box appears prompting the user if he wants to do this action or not .
Example – ConfirmButtonExtender :
Step 1 : Register AjaxControlToolkit.
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="ajaxToolkit" %>
Step 2 : Add ToolKitScriptManager to the page.
<ajaxToolkit:ToolkitScriptManager ID="Sc1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
Step 3 : Add a button and name it “Submit”.
Step 4 : Add ConfirmbuttonExtender and assign button ID to “TargetControlID” of this control.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ConfirmButtonExtender</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ajaxToolkit:ToolkitScriptManager ID="Sc1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click" style="height: 26px" />
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmbuttonExtender1" runat="server"
TargetControlID="btnSubmit" ConfirmText="Are you sure you want to submit???">
</ajaxToolkit:ConfirmButtonExtender>
</div>
</form>
</body>
</html>
If user clicks on Ok then the functionality written for click of submit button will be executed. If user clicks on Cancel , dialogue box closes and nothing happens.
Output :
No comments:
Post a Comment