Executing Javascript based on a condition in codebehind
-
Hi friends, I am currently working on an ASP.NET project using C# and i have one issue. Does anyone know how to trigger a javascript anywhere in C# code. eg : if(conditon) trigger javascript Can you please help me on this.Thank you Krugger The Truth is out there...
-
Hi friends, I am currently working on an ASP.NET project using C# and i have one issue. Does anyone know how to trigger a javascript anywhere in C# code. eg : if(conditon) trigger javascript Can you please help me on this.Thank you Krugger The Truth is out there...
-
You can add javascript using the Page.RegisterStartupScript method. Example:
Page.RegisterStartupScript("ShowAnswer", "alert('42');");
--- b { font-weight: normal; }Thanks --- b { font-weight: normal; } I came across this but was unsure whether the script will run immediately. Can i do something like this (see below) to ensure that the Javascript ShowAnswer is fired only where MyBool is true? if(MyBool) Page.RegisterStartupScript("ShowAnswer", "alert('42');"); Krugger The truth is out there..
-
Thanks --- b { font-weight: normal; } I came across this but was unsure whether the script will run immediately. Can i do something like this (see below) to ensure that the Javascript ShowAnswer is fired only where MyBool is true? if(MyBool) Page.RegisterStartupScript("ShowAnswer", "alert('42');"); Krugger The truth is out there..