AJAX Control ToolKIT ConfirmButton Extender Tutorial in ASP.NET 4.0 C#


V4 Ajax Tutorials
Server Intellect Cloud Hosting

AJAX Control ToolKIT ConfirmButton Extender Tutorial in ASP.NET 4.0 C#

 AJAX Control ToolKIT ConfirmButton Extender Tutorial in ASP.NET 4.0 C#

Hi were you looking for an AJAX tutorial? Specifically on the ConfirmButton Extender Control?

Are you sure about that? Get the theme here?

 

Well it’s all about confirming today, and we are absolutely sure you have experienced this great and very useful control before.  We are also quite positive you have also experienced an event where you wished this Control was enabled on an application or website.

Ever found yourself filling out a questionnaire form an application or profile ?, and you just typed in what seems to be the longest questionnaire of all time to only have hit the delete button by mistake or the back button on your browser by mistake? And it prompted you with Are you sure you want to leave this page? If you do everything you just wrote will be lost in the internet forever.

 

Well if that has happened to you then you are lucky that it was using a ConfirmButton or at least a variation of it. If not, you would have lost all of your valuable information.

 So in Short we will show you how to use AJAX ConfirmButton Extender, How to enable it and have it show a result or warning or whatever you may want to have it say.

 

Also if you're ever in the market for some great Windows web hosting, try Server Intellect. We have been very pleased with their services and most importantly, technical support.

 

Now that I gave you the simple user guide explanation I will also give you a Reference or a more semi technical explanation.

 

The ConfirmButton is a simple extender that catches clicks on a button and displays a message to the user. If the "OK" button is clicked, the button or link functions normally. If not, the click is trapped and the button will not perform its default submit behavior; optionally, a client script is executed if the OnClientCancel property is set. This is useful for delete links or anything else that requires confirmation from the user.

 

Got that? Are you sure?

Did You Know?

 

We chose Server Intellect for its dedicated servers, for our web hosting. They have managed to handle virtually everything for us, from start to finish. And their customer service is stellar.

 On the the Fun Stuff !! Below are the Steps

·         As Always Add New WebForm to this project and name it  ConfirmButton.aspx

·         Remember to  Add a ScriptManager to the page.

·          Then Add a ConfirmButton extender, a button and a label to the page.  Set the target control

The markup of the page will look like

 

<%@ Page Language="C#" %>

<%@ 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">

 

<script runat="server">

    protected void btnConfirm_Click(object sender, EventArgs e)

    {

        lblMessage.Text = "You clicked the <b>OK</b> button of AJAX confirm";

    }

</script>

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Confirm Button</title>

    <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>

</head>

<body>

    <form id="form1" runat="server">

        <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

    </cc1:ToolkitScriptManager>

    <asp:Label ID="Label1" runat="server" Text="Click this button to open AJAX Confirm box:" Font-Bold="true" Font-Size="16px"></asp:Label><br />

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

        <asp:Button ID="btnConfirm" runat="server" Text="Confirm" OnClick="btnConfirm_Click" />

        <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnConfirm"

            ConfirmText="Are you sure?&#10;You want to run the server code." OnClientCancel="onCancel" ConfirmOnFormSubmit="false">

        </cc1:ConfirmButtonExtender>

        <asp:Label ID="lblMessage" runat="server"></asp:Label><br />

    </ContentTemplate>

</asp:UpdatePanel>

    </form>

</body>

</html>

 

Load the page in browser looks like as follows

See how easy that was?

Not as Easy when….

We migrated our web sites to Server Intellect over one weekend and the setup was so smooth that we were up and running right away. They assisted us with everything we needed to do for all of our applications. With Server Intellect's help, we were able to avoid any headaches!

Now we encourage you o try your own variations and get creative, Get your hands Dirty with the AJAX ConfrimButton Extender, We want you to Learn AJAX. If you have any questions or concerns or want to see a Certain Subject or AJAX tutorial then please feel free to suggest one or comment below in out comment section and we will try to answer your question in the quickest possible manner.

Thanks AJAXTutorials.com



Comments
cheap baseball hats said:

ssdsadsadsadsadasdsdasdfdvcx

Posted Mar 11, 2011 4:35 AM
Louis Vuitton said:

Drive to Stem Shingles Meets Few Expectations

Posted Jul 12, 2011 10:42 PM
Hermes said:

The i cars also signal

Posted Jul 31, 2011 8:39 PM
www.prada-miumiu.comcom said:

www.prada-miumiu.comcom

Posted Aug 6, 2011 3:23 AM
indian events said:

Ajax tool kit is really working too good. It the wonderful I tried it. Really it is amazing. I like this a lot. Thanks for the great tutorial.

Posted Aug 23, 2011 12:32 AM
Asics Running said:

http://www.asicsaustore.com/ Asics Running

Asics Shoes

Asics Tiger

Onitsuka Tiger Sale

Posted Oct 21, 2011 9:28 PM

Leave a Comment