I have a messagebox with two buttons and a text. This is the relevant code:
var result = MessageBox.Show("just a text","just a title",MessageBoxButtons.OKCancel,System.Windows.Forms.MessageBoxIcon.Warning,System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification | System.Windows.Forms.MessageBoxOptions.RightAlign);
if (result == DialogResult.OK)
{
... code ...
}
My problem is that the program enters the code inside the "if" automatically and the pop up message box doesn't even show up. Even when i debug it I see that the code goes to the "if" row and the result is DialogResult.OK.
I am using web forms and ASP.Net.
the namespace for the MessageBox is "System.Windows.Forms".
I tried clearing the cache and even iisreset.
What else could help me?
Thank you in advance.
I am using web forms and ASP.Net.
the namespace for the MessageBox is "System.Windows.Forms".
Don't do that. An ASP.NET site runs at the server, so there's nobody who can click the MessageBox
if it even would pop up on the server.
If you want to show a popup to the user, it'll have to be in Javascript. See How to make a simple yes/no popup in ASP.NET that return the result back to my c#?.