Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    63
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Prompt confirmation after button click

    I wish to add an attribute to the button click in asp.net to prompt a confirmation box using javascript. Also, is it possible to perform a function after a button click before i prompt the confirmation box? This function will return a value indicating whether i should prompt the confirmation box.

    I know i should add a code as shown below but it does not work somehow:
    Code:
            btnDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to delete these rows?')")
    Thanks

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,091
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Here is an article that walks you through exactly how to do that. Hope it helps.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    63
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I tried the coding but it does not work for my webform with other coding. But if i create a new webform, it will work. Not sure why though ...

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,091
    Thanks
    2
    Thanked 23 Times in 23 Posts
    I don't know how you're building your applications, but if you're using Visual Studio to do them, and the "are you sure" file is a code-behind file, Visual Studio builds the .dll file for it automatically. If you do an Add Existing Item within Visual Studio to an existing application, Visual Studio should still build the .dll file for you.

    OTOH, if you're not using Visual Studio, you may have to build the .dll file yourself for the "are you sure" file and put it in your root directory.

    If none of the above applies, then I'm as puzzled as you are.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Quote Originally Posted by shaoen01
    I tried the coding but it does not work for my webform with other coding. But if i create a new webform, it will work. Not sure why though ...
    Post your code so we can take a look at it.

  • #6
    New Coder
    Join Date
    Aug 2005
    Posts
    63
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sorry for late reply, didnt know that you have submitted a new post. Anyway, i know why it does not work, because in my asp.net i included a onclick function in javascript for the same button causing it not to work.

    I now use that onclick function javascript to prompt for me the confirmation box. Thanks


  •  

    Posting Permissions

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