Hi,
Use the below line to call a Javascript function from Code behind file.
ScriptManager.RegisterStartupScript(page, page.GetType(), key, functionNameWithBrackets + ";", true);
Also you can use with Key :
ScriptManager.RegisterStartupScript(page, page.GetType(), key, functionNameWithBrackets + ";", true);
Key value should be 'fun' for calling a function.