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 2 capture OK or CANCEL at the messagebox using javascript or other method???

How 2 capture OK or CANCEL at the messagebox using javascript or other method???

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptasp-netsysadmin
9 Posts 5 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.
  • B Offline
    B Offline
    byan
    wrote on last edited by
    #1

    my code is using javascipt to declare the alert message, bcoz ASP.Net server-side cannot declare example - msgbox('xxx') alert('xxxx') then how can i capture OK or CANCEL from the messagebox, for example:- confrim('xxxx') or using other method 2 declare it! help??? -- modified at 1:51 Tuesday 7th February, 2006

    L S I 3 Replies Last reply
    0
    • B byan

      my code is using javascipt to declare the alert message, bcoz ASP.Net server-side cannot declare example - msgbox('xxx') alert('xxxx') then how can i capture OK or CANCEL from the messagebox, for example:- confrim('xxxx') or using other method 2 declare it! help??? -- modified at 1:51 Tuesday 7th February, 2006

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Instead of Alert Use Confirm It returns true or false. Simple to use . sanjeev

      B 1 Reply Last reply
      0
      • L Lost User

        Instead of Alert Use Confirm It returns true or false. Simple to use . sanjeev

        B Offline
        B Offline
        byan
        wrote on last edited by
        #3

        Ya, I know using Confirm, but the code is write as :- respnse.write(confirm(example)) how 2 get the true or false value???

        L 1 Reply Last reply
        0
        • B byan

          Ya, I know using Confirm, but the code is write as :- respnse.write(confirm(example)) how 2 get the true or false value???

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          btnSubmit.Attributes.Add("onclick","javascript: return confirm();"); add attribute to btnSubmit . In this case first confirm is called then button click sanjeev

          B 1 Reply Last reply
          0
          • L Lost User

            btnSubmit.Attributes.Add("onclick","javascript: return confirm();"); add attribute to btnSubmit . In this case first confirm is called then button click sanjeev

            B Offline
            B Offline
            byan
            wrote on last edited by
            #5

            Thanks 4 help! but its your code is write at c#. where 2 place your code, my code is using :- <%@ Page Language="VB" %> can u write a full set code, let me c??? TQ TQ

            G 1 Reply Last reply
            0
            • B byan

              Thanks 4 help! but its your code is write at c#. where 2 place your code, my code is using :- <%@ Page Language="VB" %> can u write a full set code, let me c??? TQ TQ

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              Well, in VB the code looks totally different. ;) What is C# is written: btnSubmit.Attributes.Add("onclick","javascript:return confirm();"); in VB becomes: btnSubmit.Attributes.Add("onclick","javascript:return confirm();") --- b { font-weight: normal; }

              1 Reply Last reply
              0
              • B byan

                my code is using javascipt to declare the alert message, bcoz ASP.Net server-side cannot declare example - msgbox('xxx') alert('xxxx') then how can i capture OK or CANCEL from the messagebox, for example:- confrim('xxxx') or using other method 2 declare it! help??? -- modified at 1:51 Tuesday 7th February, 2006

                S Offline
                S Offline
                Shiby
                wrote on last edited by
                #7

                There are two location we can capture ok or cancel a) In javascript itself b) aspx or code behind In case if you want to capture at javascript level then following code help you out if (confirm("Are you sure you want to proceed ?")) // just an example { // put your code here } else { //put your code here } let me know if you are looking at page level or code behind too.

                B 1 Reply Last reply
                0
                • B byan

                  my code is using javascipt to declare the alert message, bcoz ASP.Net server-side cannot declare example - msgbox('xxx') alert('xxxx') then how can i capture OK or CANCEL from the messagebox, for example:- confrim('xxxx') or using other method 2 declare it! help??? -- modified at 1:51 Tuesday 7th February, 2006

                  I Offline
                  I Offline
                  Ista
                  wrote on last edited by
                  #8

                  It would be easier just to have a form with the buttons. On post back you'll get the value. 1 line of code equals many bugs. So don't write any!!

                  1 Reply Last reply
                  0
                  • S Shiby

                    There are two location we can capture ok or cancel a) In javascript itself b) aspx or code behind In case if you want to capture at javascript level then following code help you out if (confirm("Are you sure you want to proceed ?")) // just an example { // put your code here } else { //put your code here } let me know if you are looking at page level or code behind too.

                    B Offline
                    B Offline
                    byan
                    wrote on last edited by
                    #9

                    Can u let me know how 2write the aspx code behind??

                    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