You can use following function to execute javascript code from code behind file in asp.net using c#.
**when you are not using ajax update panel.
public void
ExecuteJavascriptCode(System.Web.UI.Page zpage, string javaScriptCode)
{
string alertScript = "<script
language=\"javascript\" type=\"text/javascript\">";
alertScript += javaScriptCode;
alertScript += "</script>";
if (!zpage.IsClientScriptBlockRegistered("alert"))
zpage.RegisterClientScriptBlock("alert", alertScript);
}
In alert function we are using
zpage.RegisterClientScriptBlock(string key, string script).
Here zpage is object of type class System.Web.UI.Page.