To Write Javascript alert message box function in ASP.NET code behind refer the below code. Just pass the error message as parameter to this function by calling it.
- public void ShowAlertMessage(string error)
- {
- Page page = HttpContext.Current.Handler as Page;
- if (page != null)
- {
- error = error.Replace("'", "\'");
- ScriptManager.RegisterStartupScript(page, page.GetType(), "errmsg", "alert('" + error + "');", true);
- }
- }
No comments:
Post a Comment