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,
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. =/
Re: showing message box from server side (client/server inline code)
Thanks, much appreciated,
I will wait for your reply.
thanks,
Re: showing message box from server side (client/server inline code)
>< >< ><
I forgot to check this morning. FIrst thing tomorrow, I'll post it.
Re: showing message box from server side (client/server inline code)
VB Code:
Dim scriptString As String
scriptString = "<script language=JavaScript>"
scriptString &= "alert('" + message + "');"
scriptString &= "</script>"
Page.RegisterStartupScript("ShowMessage", scriptString)
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.
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.