3
Answers

Message Box

Photo of fadil1977

fadil1977

20y
4.8k
1
Hi there! I try to use Message box using C# in asp.net. I did find some sources on the web but it gives error and doesnot work.let us say that I have a log in page and if the user type incorrect details, a small window will pop up to say "sorry try again" or sometrhing like that. Can you tell me how to use the message box or window to pop up providing the code. I appreciate your time and help. Thanks for reading the message.

Answers (3)

0
Photo of neelim_p
NA 2 0 20y
Can i have that source code of javascript?
0
Photo of fadil1977
NA 83 0 20y
Hi jshelper!! Thank you for your time and response. your advice is helpful and i sort it out. Thanks again and any one read this thread who needs to know how did i sort it can freely ask me how to use the java script for this task.
0
Photo of jshepler
NA 63 0 20y
ASP.NET doesn't support the MessageBox (ala Windows Forms), so you are left on your own to do so. I know of 3 ways of doing it, but they all use JavaScript. 1. The JavaScript function alert() will popup a messagebox with the passed text and provide an OK button. 2. The JavaScript function confirm() will popup a messagebox with the passed text and provide the OK and CANCEL buttons - and will return TRUE or FALSE depending on which button was clicked. 3. The JavaScript fucntion window.open() which opens a new window. The function takes a few arguments including properties about the new window (size, if it has a title bar, etc.). What I don't know is how to pass information from the new window back to the main window that opened it, but I'm sure it's fairly easy. Do some JavaScript research into these functions to better understand how they work. In your case, I think the alert() function is what you're after. Read up on the System.Web.UI.Page.RegisterStartupScript() method. I envision your code using this method to call the alert() function when login authentication fails.