get confirm box value in asp.net page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praveengaur
    New Member
    • Mar 2008
    • 3

    #1

    get confirm box value in asp.net page

    i want to confirm for deletion , so i write javascript confirm box from aspx.cs page
    how can i get that confirm box boolean reply in aspx.cs page
    [code=vbnet]
    ClientScript.Re gisterStartupSc ript("text/jscript".GetTyp e(), "Message", "<script>"+repl y+"=Confirm(' Do you want to delete or not')</script>;");[/code]
    Last edited by Frinavale; Mar 17 '08, 02:15 PM. Reason: added [code] tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    HI praveengaur

    Welcome to TheScripts family.

    Feel free to post questions in the related forum only by choosing from under the blue bar on the top of your page.

    Please follow the posting guidelines in every new post/reply.

    Please specify your post/question clearly.Please use proper code tags in all your codes.

    Regards
    Debasis

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      In your javascript, trigger a postback on succes or a "return false;" if they cancel?

      Comment

      • praveengaur
        New Member
        • Mar 2008
        • 3

        #4
        Originally posted by Plater
        In your javascript, trigger a postback on succes or a "return false;" if they cancel?
        what should i write in my aspx.cs page

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          In the button on your aspx page, you would add the onClientClick attribute.
          Probably with something like:
          [code=asp]
          onClientClick=" return Confirm('Whatev er message');"
          [/code]

          Then if they say "ok" any other actions tied to the button will be performed, if they say "cancel", all other button actions will be ignored. (return true or return false)

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by Plater
            In the button on your aspx page, you would add the onClientClick attribute.
            Probably with something like:
            [code=asp]
            onClientClick=" return Confirm('Whatev er message');"
            [/code]

            Then if they say "ok" any other actions tied to the button will be performed, if they say "cancel", all other button actions will be ignored. (return true or return false)
            In other words, Plater's saying that the confirm box returns a true or false value indicating if the user clicked "ok" or "cancel".
            When you specify the JavaScript onclick event as:
            [code=javascript]
            onclick=return confirm('whatev er message');
            [/code]

            If the user clicks "cancel", false is returned and the postback is prevented from happening. If the user clicks "ok", true is returned and the postback for the button is executed.

            -Frinny

            Comment

            Working...