Monday, 2 September 2013

HOW TO USE ASP.NET CONFIRM BUTTON EXTENDER CONTROL

HOW TO USE ASP.NET CONFIRM BUTTON EXTENDER CONTROL

1) Create Website2) Add aspx page
3) Add toolkitScriptManager
4) If you don't have ajax control toolkit  download from codeplex
5) Add ConfirmButton Extender

asp:ConfirmButtonExtender Properties
1) TargetControlID -> asp button/linkbutton
2) ConfirmText --> "Text to displayed"
3)OnClientCancel

          Javascript function excecuted on Cancel button click    


<script type="text/javascript">
        function ClientCancel() {

            alert('cancel clicked');
        }
    </script>
</head>
<body>


        <div>

        <asp:Button ID="btnSubmit" runat="server" value="Auto Confirm Button"  Text="Confirm Button Extender Demo"/>
            <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server"
             TargetControlID="btnSubmit" ConfirmText="Do u want to Close this Window?"
             ConfirmOnFormSubmit="true" OnClientCancel="ClientCancel"  
            >
            </asp:ConfirmButtonExtender>

    </div>


5) Run the Webpage

Here is the Output.