I have a JS script which I wrote in my code behind. This is not giving me any err or anything but it is not showing me an alert mesg. I am using Visual Studio 2010 with 4.0 framework. Here is my code:
MessageBox1("Testing my Message"); //Calling Function!
private void MessageBox1(string msg) //This is in the code behind of the page.
// Cleans the message to allow single quotation marks
string cleanMessage = msg.Replace("'", "\\'");
// Gets the executing web page
Page page = HttpContext.Current.CurrentHandler as Page;
// Checks if the handler is a Page and that the script isn't allready on the Page
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
page.ClientScript.RegisterClientScriptBlock(typeof(CommSetup), "alert", script);
Why it is not showing any alert box?