Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP:NET
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
0 OriginalGriff 420
1 DamithSL 253
2 Sergey Alexandrovich Kryukov 210
3 Peter Leow 205
4 Maciej Los 195

Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid