Professional Web Applications Themes

PopUp Message aka Msgbox - ASP.NET General

All Have searched the fields and hills for a good example but alass not a sausage have I found, well not quite! I understand that you cannot have a msgbox and have come up with the solution to use Javascript on the Onclick Event. Code: DeleteBtn.Attributes.Add("onClick", "javascript :return confirm('Do you really want to?');") Now this is fine, works and gives me an OK and CANCEL option, problem is how do I get a return value? Cannot seem to find an answer to this anywhere! Thanks...

  1. #1

    Default PopUp Message aka Msgbox

    All

    Have searched the fields and hills for a good example but
    alass not a sausage have I found, well not quite!

    I understand that you cannot have a msgbox and have come
    up with the solution to use Javascript on the Onclick
    Event.

    Code:

    DeleteBtn.Attributes.Add("onClick", "javascript:return
    confirm('Do you really want to?');")

    Now this is fine, works and gives me an OK and CANCEL
    option, problem is how do I get a return value?

    Cannot seem to find an answer to this anywhere!

    Thanks
    yop Guest

  2. #2

    Default PopUp Message aka Msgbox

    Hi

    Call a javascript function in onclick event of button.
    Try this:

    DeleteBtn.Attributes.Add
    ("onClick", "javascript:checkConfirm()")

    <script language=javascript>
    function checkConfirm()
    {
    var res = confirm('Do you really want to?');
    //user res
    }
    </script>



    Ravikanth[MVP]
     
    but 
    Ravikanth[MVP] Guest

  3. #3

    Default Re: PopUp Message aka Msgbox

    yop,

    Try this out:

    WebControlButton.Attributes.Add("onClick", "javascript:if(!confirm('" &
    MessageToDisplay & "')) return false;")

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "yop" <net> wrote in message
    news:0a1401c36bc1$ff1d0d20$gbl... 


    S. Guest

  4. #4

    Default PopUp Message aka Msgbox

    A stupid question but if I was to add that CheckConfirm
    code into a vb file how would it work?
    Apologise about this.

    Or if I leave it in the HTML how do I grab the result
    from inside in the VB file?

     
    >but [/ref]
    come 
    >.
    >[/ref]
    yop Guest

  5. #5

    Default Re: PopUp Message aka Msgbox

    You are already getting a return value. Your script says so. It says "return
    confirm('Do you really want to?')". This cancels any submit that might
    happen. What else would you like to do with the return value from the
    JavaScript confirm() function?

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    The more I learn, the less I know.

    "yop" <net> wrote in message
    news:0a1401c36bc1$ff1d0d20$gbl... 


    Kevin Guest

  6. #6

    Default Re: PopUp Message aka Msgbox

    The click even of the button is still happening
    regardless of wheather or not the user is clicking Yes or
    No? must be leaving something out somewhere


     
    so. It says "return 
    submit that might 
    value from the [/ref]
    but [/ref]
    come 
    >
    >
    >.
    >[/ref]
    yop Guest

  7. #7

    Default Re: PopUp Message aka Msgbox

    Yop,

    If you try out the code I posted you'll see that the button click never
    fires client side if you click cancel.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "yop" <net> wrote in message
    news:0b9001c36bd5$b14dfc30$gbl... 
    > so. It says "return 
    > submit that might 
    > value from the [/ref]
    > but [/ref]
    > come 
    > >
    > >
    > >.
    > >[/ref][/ref]


    S. Guest

  8. #8

    Default Re: PopUp Message aka Msgbox

    Apologies S Justin! I took the first solution that was
    there. It works spot on, I am sure that the other one
    works as well, just did not seem to do it for me!!

    Thanks all much appreicated

     
    (!confirm('" & [/ref]
    but [/ref]
    come 
    >
    >
    >.
    >[/ref]
    yop Guest

Similar Threads

  1. Error Message Popup
    By FarmOp68 in forum Macromedia Flash Player
    Replies: 2
    Last Post: July 3rd, 06:47 PM
  2. Popup Message
    By CCBrown in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: September 6th, 09:56 AM
  3. How to show popup message in a webform
    By Ipsita in forum ASP.NET Web Services
    Replies: 2
    Last Post: November 15th, 03:14 AM
  4. Message Popup in PHP
    By Felix in forum PHP Development
    Replies: 2
    Last Post: January 12th, 09:38 PM
  5. How to popup confirm message box in asp.net
    By Padam Jain in forum ASP
    Replies: 4
    Last Post: July 14th, 10:45 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139