Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to get the return value of Javascript Confirmation MessageBox in ASP.Net?

How to get the return value of Javascript Confirmation MessageBox in ASP.Net?

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    codddy
    wrote on last edited by
    #1

    Hi all, I have been trying to use Javascript Confirmation Message Box in Asp.Net. However, I can not get the return value of this message box. I have tryed the method to add attributes at Page Load using the code like below: ******************** ibtnDelete.Attributes.Add("language", "javascript") ibtnDelete.Attributes.Add("OnClick", "return confirm('Are you sure you want to delete this record?');") This will bring up an OK/Cancel box when the button is clicked; if Cancel is then clicked the button's click event code won't run. ******************** But I want, firstly to run the click event of the button, and than according to some calculations give the user a message asking whether he / she wants to continue??, if the user says YES --> execute some code if NO --> execute nothing Is there a way to solve this problemm?? Thanks to everyone...

    S 1 Reply Last reply
    0
    • C codddy

      Hi all, I have been trying to use Javascript Confirmation Message Box in Asp.Net. However, I can not get the return value of this message box. I have tryed the method to add attributes at Page Load using the code like below: ******************** ibtnDelete.Attributes.Add("language", "javascript") ibtnDelete.Attributes.Add("OnClick", "return confirm('Are you sure you want to delete this record?');") This will bring up an OK/Cancel box when the button is clicked; if Cancel is then clicked the button's click event code won't run. ******************** But I want, firstly to run the click event of the button, and than according to some calculations give the user a message asking whether he / she wants to continue??, if the user says YES --> execute some code if NO --> execute nothing Is there a way to solve this problemm?? Thanks to everyone...

      S Offline
      S Offline
      smarttom99
      wrote on last edited by
      #2

      It's difficult mixing javascript confirmation with .cs code. The best bet for what you're trying to do is to use a modalpopupextender and then you have control over the buttons in your code.

      C 1 Reply Last reply
      0
      • S smarttom99

        It's difficult mixing javascript confirmation with .cs code. The best bet for what you're trying to do is to use a modalpopupextender and then you have control over the buttons in your code.

        C Offline
        C Offline
        codddy
        wrote on last edited by
        #3

        hmmm, how can I use this (modalpopupextender)?? thanks...

        S 1 Reply Last reply
        0
        • C codddy

          hmmm, how can I use this (modalpopupextender)?? thanks...

          S Offline
          S Offline
          smarttom99
          wrote on last edited by
          #4

          It's part of the ajaxtoolkit. I'm thinking it might even be better to use the ConfirmButton. Below is the url on how it all works. http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.aspx

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups