CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    70

    javascript confirm box - delete call in servder side

    Hello
    In my web page (asp net 2.0), shows some data from database based on a search click, I placed another button for delete. When user click on the
    delete button - a client event is fired displaying confirm box, as shown below.

    1. When user clicks yes, I want to call actual delete procedure (running in server side). How can I invoke the delete procedure in server side.
    when user clicks yes, if ckicks no, no need to call server procedure.

    2. Can we access/delete an entry from database using pure javascript code
    running from client side.

    Thnks in advance


    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="Button1" runat="server" Text="Remove"
    OnClientClick="javascript:return confirm('Are you sure you want to delete this entry?');" /></div>
    </form>
    </body>
    </html>
    VB.Net 2005, Net Framework 2.0

  2. #2
    Join Date
    Jan 2008
    Posts
    47

    Re: javascript confirm box - delete call in servder side

    button_click()
    {
    // write the code for delete from table...
    important is that, only when user click yes this even will be fired
    }

  3. #3
    Join Date
    May 2002
    Posts
    10,943

    Re: javascript confirm box - delete call in servder side

    If you are are working with a mix of client-side and server-side, then you have to pass the information from the client-side to the server.

    Code:
    <script type="text/javascript">
    function deleteStuff() {
      if (confirm('Are you sure you want to delete this entry?')) {
        window.location = 'page.asp?delete=SOME_ID';
      }
    }
    </script>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured