Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project I would like to use message box. I get error. In windows forms it works but not in web page. Can anyone advice.

System.MessageBox.Show("ddd");
Posted

Hi,
You can use as below code(javascript+c#)

C#
public void msgbox(string message)
   {
       string msg = @"alert('" + message + "');";
       ScriptManager.RegisterStartupScript(this, this.GetType(), "s1", msg, true);
   }



Source : Message Box in Asp.Net C#[^]
If you find it helps you please mark as ans & vote also
Hemant Singh
 
Share this answer
 
This thing will not work in webpages-do not have messagebox but have alerts or modal dialogs based messages.And the MessageBox.Show("") works for win-Forms
So you can use these-
using jqyery-
modal-message[^]

using javascipt
Asp.net show alert message from code behind using javascript[^]

using ajax-modal popup extender
Ajax ModalPopUpExtender Example[^]

or still you want to use Messagebox.Show("") in webpages after viewing these easy examples and designs then
A Windows Form like MessageBox for ASP.NET Website[^]

read more-
Buttons, Message Box, and Confirm Box in ASP.NET 3.5[^]
Server Side Message Box in VB.NET and C#[^]
Types of Popups in webpages using javascript[^]
Building Modal Popup using ASP.Net AJAX ModalPopupExtender Control[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900