On a click event I call the same JavaScript function 3 times but the javascript function itself only execute once.
BLL.Common.executeJSFunction("DoSomething();");
BLL.Common.executeJSFunction("DoSomething();");
BLL.Common.executeJSFunction("DoSomething();");
The method:
public static void executeJSFunction(string jsFunction)
{
var page = HttpContext.Current.Handler as Page;
ScriptManager.RegisterStartupScript(page, page.GetType(), "Exec", jsFunction, true);
}
Java script function:
function DoSomething()
{
alert('Hello Word');
}
ps: There is a ScriptManager and a update panel on the page just in case....