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. Javascript confirmation in asp.net

Javascript confirmation in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-net
11 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.
  • N Nagraj Naik

    Hi, To show confirmation dialog on button click we use button1.Attributes.Add("OnClick", "var ans =Check_Duplication();") But in my case I need to check some value if that value is zero then I want to display confirmation box. ex. button_click() { if customerId=0 then //// show confirmation box end if } Thanks, Nagarj.

    K Offline
    K Offline
    kapil bhatnagar
    wrote on last edited by
    #2

    check dis condition in the javascript function and accordingly display the confirmation box else return back eg.button1.Attributes.Add("onclick","javascript:return test(cutomerId);") function test(val) { if(val ==0) { //call confirm() } } modify the code accordingly ..

    N 1 Reply Last reply
    0
    • K kapil bhatnagar

      check dis condition in the javascript function and accordingly display the confirmation box else return back eg.button1.Attributes.Add("onclick","javascript:return test(cutomerId);") function test(val) { if(val ==0) { //call confirm() } } modify the code accordingly ..

      N Offline
      N Offline
      Nagraj Naik
      wrote on last edited by
      #3

      Hi Kapil, Actually on button click I check duplication of record which I want to insert and set variable cnt to 1 for dulication and display confirmation msg. now parameter I need to send in javascript function is get assigned on button click...so how could I...... button_click() { Dim cnt As Integer = CheckProjectDuplication(ProjectName) If (cnt > 0) Then /// show confirmation end if } I hope u understand my problem.... Thanks, Nagraj

      I 1 Reply Last reply
      0
      • N Nagraj Naik

        Hi Kapil, Actually on button click I check duplication of record which I want to insert and set variable cnt to 1 for dulication and display confirmation msg. now parameter I need to send in javascript function is get assigned on button click...so how could I...... button_click() { Dim cnt As Integer = CheckProjectDuplication(ProjectName) If (cnt > 0) Then /// show confirmation end if } I hope u understand my problem.... Thanks, Nagraj

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #4

        Nagraj Naik wrote:

        button_click() { Dim cnt As Integer = CheckProjectDuplication(ProjectName) If (cnt > 0) Then /// show confirmation end if }

        Dim cnt As Integer = CheckProjectDuplication(ProjectName)

        If (cnt > 0) Then
        Response.Write("alert('Done');");
        end if

        Best regard pAthan

        please don't forget to vote on the post that helped you.

        N 1 Reply Last reply
        0
        • I Imran Khan Pathan

          Nagraj Naik wrote:

          button_click() { Dim cnt As Integer = CheckProjectDuplication(ProjectName) If (cnt > 0) Then /// show confirmation end if }

          Dim cnt As Integer = CheckProjectDuplication(ProjectName)

          If (cnt > 0) Then
          Response.Write("alert('Done');");
          end if

          Best regard pAthan

          please don't forget to vote on the post that helped you.

          N Offline
          N Offline
          Nagraj Naik
          wrote on last edited by
          #5

          Hi Imran, I want to show confirmation dialog box and not a dialog box. Thanks, Nagraj

          I 1 Reply Last reply
          0
          • N Nagraj Naik

            Hi Imran, I want to show confirmation dialog box and not a dialog box. Thanks, Nagraj

            I Offline
            I Offline
            Imran Khan Pathan
            wrote on last edited by
            #6

            write confirm instead of alert

            please don't forget to vote on the post that helped you.

            N 1 Reply Last reply
            0
            • I Imran Khan Pathan

              write confirm instead of alert

              please don't forget to vote on the post that helped you.

              N Offline
              N Offline
              Nagraj Naik
              wrote on last edited by
              #7

              Hi, It will not work. u can try any sample application. thanks, nagraj

              I N 2 Replies Last reply
              0
              • N Nagraj Naik

                Hi, To show confirmation dialog on button click we use button1.Attributes.Add("OnClick", "var ans =Check_Duplication();") But in my case I need to check some value if that value is zero then I want to display confirmation box. ex. button_click() { if customerId=0 then //// show confirmation box end if } Thanks, Nagarj.

                M Offline
                M Offline
                Michael Sync
                wrote on last edited by
                #8

                You can use confirm() for that.. If you are interested to create a custom javascript confirm dialog, you can check this.

                Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

                1 Reply Last reply
                0
                • N Nagraj Naik

                  Hi, It will not work. u can try any sample application. thanks, nagraj

                  I Offline
                  I Offline
                  Imran Khan Pathan
                  wrote on last edited by
                  #9

                  try following code

                  if(confirmid==0)
                  {
                  Response.Write("window.confirm('?');");
                  }

                  Best regard pAthan

                  please don't forget to vote on the post that helped you.

                  1 Reply Last reply
                  0
                  • N Nagraj Naik

                    Hi, It will not work. u can try any sample application. thanks, nagraj

                    N Offline
                    N Offline
                    N a v a n e e t h
                    wrote on last edited by
                    #10

                    Nagraj Naik wrote:

                    u can try any sample application.

                    Do you want to execute some other code when user clicks "ok" on confirm box ? If yes Pathan's suggestion won't work.

                    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                    N 1 Reply Last reply
                    0
                    • N N a v a n e e t h

                      Nagraj Naik wrote:

                      u can try any sample application.

                      Do you want to execute some other code when user clicks "ok" on confirm box ? If yes Pathan's suggestion won't work.

                      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                      N Offline
                      N Offline
                      Nagraj Naik
                      wrote on last edited by
                      #11

                      Hi, Absolutely...I want to write some code on "OK" select. Thanks, Nagraj.

                      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