Click here to Skip to main content
13,448,598 members (54,804 online)
Rate this:
Please Sign up or sign in to 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.

Posted 26-Jan-13 17:18pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use as below code(javascript+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
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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-

using javascipt 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[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180318.3 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100