This topic is locked
[SOLVED]

  Response.Write not seen on page, message, and message bo

5/20/2011 9:55:09 AM
ASPRunnerPro General questions
B
beachldy author

I'm very new to web apps, so excuse my ignorance. In VB, it's quite easy to have a message box appear after a user runs a function, using msgbox(msg) etc, or making a label or textbox display a message. With ASP, I'm lost.
After sending an email, I'd like a message to appear on the asp form letting the user know the result. Nothing appears on the page using the code below (snippet behind a button Server code). I'd want the message to appear near the button that runs the email function. I can get response.write to work on a basic html page but not on the asp page. Can anyone point me in the right direction to doing 2 things? (1. write a message to the ASP form 2. Use a message box where a user can select select yes or no, or is that even possible?)
if not ret("mailed") then

response.write ret("Email was not sent.")

else

response.write ret("Email was sent.")

end if
Thanks, any help would be appreciated.

Sergey Kornilov admin 5/20/2011

Check this article in the manual:

http://xlinesoft.com/asprunnerpro/docs/insertingbutton.htm
Example 1 explains how to pass parameters from OnServer section to ClientAfter section and how to display them on the page.
Response.Write won't work with buttons because button's OnServer code is executed asynchronously via AJAX.

More info on AJAX: http://en.wikipedia.org/wiki/Ajax
%28programming%29
To interact with user via popups use Javascript functions alert(), prompt() and confirm().

More info: http://www.w3schools.com/js/js_popup.asp

B
beachldy author 5/23/2011

I tried the first method, but nothing happens. What am I doing wrong?
a. Server:

if not ret("mailed") then

result("txt") = "Email was sent."

else

result("txt") = "Email was not sent successfully."

end if
b. Client After:

var message = result["txt"] + ".";

B
beachldy author 5/23/2011

Aha, needed the following to get it to work:
ctrl.setMessage(message);
Thanks, we got it now!