Help me to show the jquery confirm box.

If I move the tags out of content panel it works well.

http://www.clientsideasp.net/2009/06/16/showing-beautiful-message-boxes-in-aspnet-web-forms-using-jquery-impromptu/

By using the above site I wrote the code. But I use Ajax.

    Protected Sub babubabu_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles babubabu.Click

        'If IsValid Then

        'The prompt function shl'd be called inside $(document).ready() function inorder to avoid 

        'IE's "Operation aborted" error

        'in this script we are using {{ for JQuery code becuase the string need to be used inside a String.Format function - otherwise you need to use only one {

        Dim prompt As String = "<script>$(document).ready(function(){{$.prompt('{0}!');}});</script>"

        Dim message As String = String.Format(prompt, "This message is coming after postback.<br />Hello " & txtName.Text)

        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Key", String.Format(prompt, "This message gffg is coming after postback.<br />Hello " & txtName.Text), True)

    End Sub

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>


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

    <%-- For showing jquery confirmation message --%>
    <script src="JQuery/jquery.js" type="text/javascript"></script>
    <script src="JQuery/jquery-impromptu.2.6.min.js" type="text/javascript"></script>
    <script src="JQuery/JScript1.js" type="text/javascript"></script>
    <link href="JQuery/impromptu.css" rel="stylesheet" type="text/css" />
    <%-- For showing jquery confirmation message --%>

    <script language="javascript" type="text/javascript">

        function confirmSubmit() {
            $.prompt('Are you sure you want to submit?'
            , {
                buttons: { Ok: true, Cancel: false }
                , callback: confirmSubmitResult
            }
        );
            return false;

        }
        function confirmSubmitResult(v, m, f) {
            if (v) //post back if the user clicked OK
                $('#<%= babubabu.ClientID %>').click();
        }    
    </script>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <%--            <Scripts>
                <asp:ScriptReference Path="~/JQuery/jquery-impromptu.2.6.min.js" />
                <asp:ScriptReference Path="~/JQuery/jquery.js" />
                <asp:ScriptReference Path="~/JQuery/JScript1.js" />
                <asp:ScriptReference Path="~/JQuery/impromptu.css" />
              </Scripts>--%>
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>

               [B] <div>
                    Name:
                    <asp:TextBox runat="server" ID="txtName" />
                    <br />
                    <br />
                    <!-- The button which will display the delete confirmation -->
                    <input type="button" onclick="return confirmSubmit();" value="Submit" />
                    <!-- Hidden command button that actually issues the delete -->
                    <asp:Button runat="server" ID="babubabu" Style="display: none;" />
                    <!-- Explanation -->
                </div>[/B]
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    </form>

</body>

</html>

Thanks
Babu Kumarasamy

Try using code tags around the code.
I don't know too much about asp, but it looks like this code $('#<%= babubabu.ClientID %>').click(); is referencing an id that doesn't exist.
Do you have the page online?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.