Results 1 to 7 of 7

Thread: showing message box from server side (client/server inline code)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Location
    Toronto, Canada
    Posts
    28

    showing message box from server side (client/server inline code)

    Hi,

    In my application on Submit button, I want to do the following in same sequence;

    1. Check Duplicate in DB
    2. If Exists send message to user
    3. If user says Yes then insert into db
    4. If user says no don't do anything

    On submit button I can check duplicates in DB in code behind file, if exists how can I send a message to user and take his input, I tried

    Response.Write("<Script Language=Javascript> confirm("duplicate!!") </Script>");

    but it doesn't work.

    Can anyone tell me how can I acheive the above.

    thanks,

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: showing message box from server side (client/server inline code)

    I have this at work and can get you the code that works for sure tomorrow morning... But I think you need to use alert instead of confirm. I can't verify that for sure right now. =/

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Location
    Toronto, Canada
    Posts
    28

    Re: showing message box from server side (client/server inline code)

    Thanks, much appreciated,

    I will wait for your reply.

    thanks,

  4. #4
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: showing message box from server side (client/server inline code)

    >< >< ><

    I forgot to check this morning. FIrst thing tomorrow, I'll post it.

  5. #5
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: showing message box from server side (client/server inline code)

    VB Code:
    1. Dim scriptString As String
    2.         scriptString = "<script language=JavaScript>"
    3.         scriptString &= "alert('" + message + "');"
    4.         scriptString &= "</script>"
    5.         Page.RegisterStartupScript("ShowMessage", scriptString)

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Location
    Toronto, Canada
    Posts
    28

    Re: showing message box from server side (client/server inline code)

    Thanks Buddy, I think I was not that clear in my post;

    You solution has the same behaviour as
    Response.Write("<Script Language=Javascript> confirm("duplicate!!") </Script>");

    It doesn't stop processing on message box. What I need is it should stop/halt processing while message box is displayed and as soon as user click Yes or No on message box application should perform certain steps accordingly.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: showing message box from server side (client/server inline code)

    You cannot do that. The page is executed as a whole.

    If you want something like this, then redirect the page when an error occurs in your logic with a confirmation question, after which you could redirect back.

Posting Permissions

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



Click Here to Expand Forum to Full Width