Alert (MessageBox) from serverside ASP.NET

Some times we require conditional alert message. if any validation breaks then error message should come.

private void MessageBox(string msg)
{
Page.Controls.Add(new LiteralControl("<script language='javascript'> window.alert('" + msg + "')</script>"));
}

1 comment: