2
Answers

Calling javascript from the codebehind?

Photo of Administrator

Administrator

22y
2k
1
Does anyone know how toCalling javascript from the codebehind using C#? Thanks :)

Answers (2)

0
Photo of Administrator
Admin 2.3k 1.3m 22y
okay a little method I use: do what you have to do in C# then have a checkBox hidden on the page, ensure the CheckBox is set to runat="Server" and has an ID. then when you have finished processing in C# set the CB to checked. in Javascript test that checkbox and if it's checked, uncheck it and do the processing you need to do in javascript.
0
Photo of Administrator
Admin 2.3k 1.3m 22y
Common misunderstanding :) ASP.NET is a server-side scripting engine, JavaScript, in contrast, is a type of client script. ASP.NET runs at the server, your browser receives pure html. JavaScript has to be interpreted by your browser and runs at your own PC. Regarding this, it is impossible to call JS from ASP.NET!