Alert Message using C#
Usually we generate Alert Message using Java Script in our .aspx page. But we can also generate an Alert Message from out Code behind page using C# and JavaScript. Below is the code which will display the Alert Message up on Button Click.
1 2 3 4 5 6 7 8 9 10 | private void MessaegBox(String msg) { Page.Controls.Add(new LiteralControl("window.alert('" + msg + "')")); } protected void btnAlertMsg_Click(object sender, EventArgs e) { String msg1 = "Are You sure.........."; MessaegBox(msg1); } |
Filed Under: Language Basics