Problem showing alert message from code
-
Hi.I want to show the javascript alert message if the conditions fail,but the following code is not showing the alert message.when i am putting break point it is going to this code but not showing message.what is wrong in this code. Page page = HttpContext.Current.Handler as Page; if ((System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".jpg") | (System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".bmp") | (System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".png")) { if (page != null) { page.ClientScript.RegisterStartupScript(page.GetType(), "msgbox", "alert('Upload only jpeg or bmp or png Images');", true); } }
-
Hi.I want to show the javascript alert message if the conditions fail,but the following code is not showing the alert message.when i am putting break point it is going to this code but not showing message.what is wrong in this code. Page page = HttpContext.Current.Handler as Page; if ((System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".jpg") | (System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".bmp") | (System.IO.Path.GetExtension(cmdBrowse.FileName).ToLower() != ".png")) { if (page != null) { page.ClientScript.RegisterStartupScript(page.GetType(), "msgbox", "alert('Upload only jpeg or bmp or png Images');", true); } }