You have to use the namespace System.Windows.Forms
and then you can use Message box property
e.g.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
**using System.Windows.Forms;**
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MessageBox.Show("Machine Cannot Be Deleted", "Delete from other Places
first", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Among the other alternatives (apart from the one Mr.Brandon has proposed)
a) Use javascript
e.g.
Response.Write("<script>alert('Machine Cannot Be Deleted')</script>");
b) Make a custom function that will work like a message box
e.g.
protected void Page_Load(object sender, EventArgs e)
{
MyCustomMessageBox("Machine Cannot Be Deleted");
}
private void MyCustomMessageBox(string msg)
{
Label lbl = new Label();
lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "')</script>";
Page.Controls.Add(lbl);
}
Hope this helps