473,809 Members | 2,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use MessageBox.Show () method

13 New Member
How to use MessageBox.Show () method in ASP.NET

I mean what namespace should be added...?
Sep 1 '08 #1
8 20457
Curtis Rutland
3,256 Recognized Expert Specialist
We've had this question several times in the last week or so

The answer is that it is not possible. MessageBox is part of the System.Windows. Forms namespace, but since all ASP.NET code is executed on the server not the client, you won't get a client-side popup. Theoretically, the popup will appear on the server, though I've never tested that. What is for sure is that it won't show up on the client's screen.

You will have to use Javascript for this.
Sep 1 '08 #2
shwethatj
13 New Member
We've had this question several times in the last week or so

The answer is that it is not possible. MessageBox is part of the System.Windows. Forms namespace, but since all ASP.NET code is executed on the server not the client, you won't get a client-side popup. Theoretically, the popup will appear on the server, though I've never tested that. What is for sure is that it won't show up on the client's screen.

You will have to use Javascript for this.

Hi . Thanks a lot for your reply. I am new to the .net. I have no idea about using MessageBox.Show () method.
I tried to import different namespaces including System.Windows. Forms to make it work. But every time i got this error.
" The name 'Messagebox' does not exist in the current context "

So now i have to try this using Javascript.
Sep 2 '08 #3
PRR
750 Recognized Expert Contributor
How to use MessageBox.Show () method in ASP.NET

I mean what namespace should be added...?
Firstly" ASP.NET code is executed on the server not the client, you won't get a client-side popup"
You actually cant do that .. Though for testing purpose... u could... it u run your website.. from VS studio... on same PC.. as the web site...
Add reference to
System.Windows. Forms;

and then u can use messagebox.show (); Use only for testing purpose... In real environment the result would be different....
Sep 2 '08 #4
Plater
7,872 Recognized Expert Expert
Since I didn't see it mentioned, it might help that in javascript it's called alert()

So in javascript code you would have:
Expand|Select|Wrap|Line Numbers
  1. alert("this is my alert box messages");
  2.  
Sep 2 '08 #5
shwethatj
13 New Member
Thank you all for the replies.....

I tried
MessageBox.Show ("Hello World");
and its working ..

But for
MessageBox.Show (ex.Message, "Report could not be created",
MessageBoxButto ns.OK, MessageBoxIcon. Error) in catch method , that is for

catch (MySql.Data.MyS qlClient.MySqlE xception ex)
{
MessageBox.Show (ex.Message, "Report could not be created", MessageBoxButto ns.OK, MessageBoxIcon. Error);

}

am getting the following error "Access denied for user 'root'@'localho st'(using password: YES)"

Please can anyone help me , as i am very new to .net i dont have any idea regarding this.

Thanks and Regards,
Shwetha
Sep 4 '08 #6
PRR
750 Recognized Expert Contributor
But for
MessageBox.Show (ex.Message, "Report could not be created",
MessageBoxButto ns.OK, MessageBoxIcon. Error) in catch method , that is for

catch (MySql.Data.MyS qlClient.MySqlE xception ex)
{
MessageBox.Show (ex.Message, "Report could not be created", MessageBoxButto ns.OK, MessageBoxIcon. Error);

}

"MySql.Data.MyS qlClient.MySqlE xception ex"?
You are connecting to Database using root'@'localhos t password: YES)??
then the problem lies with the username n password


"am getting the following error "Access denied for user 'root'@'localho st'(using password: YES)"

You are unable to connect to database with the username n password as far as i can see.
Sep 4 '08 #7
shwethatj
13 New Member
But for
MessageBox.Show (ex.Message, "Report could not be created",
MessageBoxButto ns.OK, MessageBoxIcon. Error) in catch method , that is for

catch (MySql.Data.MyS qlClient.MySqlE xception ex)
{
MessageBox.Show (ex.Message, "Report could not be created", MessageBoxButto ns.OK, MessageBoxIcon. Error);

}

"MySql.Data.MyS qlClient.MySqlE xception ex"?
You are connecting to Database using root'@'localhos t password: YES)??
then the problem lies with the username n password


"am getting the following error "Access denied for user 'root'@'localho st'(using password: YES)"

You are unable to connect to database with the username n password as far as i can see.
Hi....Even I guessed the same. But I had installed mysql and its working...
ok now I will try to unistall it and again i wil reinstall ...
Thanks for the reply ...
Sep 4 '08 #8
Curtis Rutland
3,256 Recognized Expert Specialist
Thank you all for the replies.....
I tried
MessageBox.Show ("Hello World");
and its working ..
Just so you understand, that really doesn't work. If it worked for you, that's because you are probably using Visual Studio's debugging server, and you're seeing the server popup, not the client.

Simply put, MessageBox does not exist as far as a website is concerned.
Sep 4 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2450
by: Saso Zagoranski | last post by:
Hi! I'm trying to make my own MessageBox... What I would like to know is, how the MessageBox class is implemented? I could have something like: new MyMessageBox().ShowDialog(); but I would like the solution used by MessageBox, where you call the static Show() method, which returns a DialogResult value...
4
1930
by: Tressa | last post by:
I have a messagebox that I only want to pop up only if it is not already being displayed on the screen. My code is still poping up the messagebox even though it is on the screen. What am I doing wrong here. Any suggestions on how to fix this using System; using System.Collections; using System.ComponentModel;
0
4092
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; namespace Utils {
5
3190
by: Robert Heuvel | last post by:
Hi, this is what I did: public struct SWaitCursor:IDisposable { public SWaitCursor (int i) { Cursor.Current = Cursors.WaitCursor; } void System.IDisposable.Dispose() { Cursor.Current = Cursors.Default;
1
1743
by: joye | last post by:
Hi, I know how the show a MessageBox in Form.h module by using VC.NET. But I don't know how to show the MessageBox at another class such as task.cpp which called by the Form.h; my question is how to pass the arguments from Form.h to a MessageBox::Show() which included in a class method. Thanks. Tsung-Yu Liu
5
1561
by: Curt Emich | last post by:
I always thought writing a simple diagnostic message in a message box would be pretty simple. Not in .NET. First, I wrote this amazingly complex piece of code: MessageBox.Show("yer mama") It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference to that method in my project". I muzed correctly. So I added a reference to System.Windows.Forms, which is where our beloved "MessageBox" method
5
9174
by: roberto | last post by:
Hi at all i have a web application (in vb.net), and i want to use a message box control like System.Windows.Forms.MessageBox control, to show simple messages . I used this but vb.net said me an exception: Imports System.Windows.Forms 'Dim msgBox As MessageBox 'msgBox.Show("User updating successful.", MessageBoxButtons.OK, MessageBoxIcon.Information)
10
8303
by: Ed Bitzer | last post by:
One option of the messagebox object indicates it can be placed over a selected window rather than just appearing centered on the desktop. The function is "Overloads Public Shared Function Show(IWin32Window, String) As DialogResult" I have unsuccessfully tried: /// Dim winhandle as string Dim rtn as DialogResult winHandle = Me.Handle.ToString()
6
3502
by: Goran Djuranovic | last post by:
Hi all, I have a VB.NET windows application that uses MDI form. When I try to delete a datagrid row from one of the MDI children forms, I use a MessageBox YesNo confirmation, which, after confirmed, minimizes the MDI form. Why is this happening and how can I prevent it? Important thing to say is, if I use just "OK" MessageBox, it DOES NOT minimize the MDI parent. TIA Goran
3
5156
Fr33dan
by: Fr33dan | last post by:
Hi All, I'm working on adding a message box method that will allow me to display a message to the user without waiting for the user to answer. I've done this by starting MessageBox.Show in a separate thread. I also use a static DialogResult variable to allow me to see the user's result in my calling code. My method also accepts a MessageBoxButtons parameter that is then passed on to the MessageBox.Show method. The only problem is that I...
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.