javascript - Calling a function in js file from C# code -


i having cs file want call function of js file.

js file

function foo(date){ //code } 

in cs file, want call foo function. possible ? if yes, how ?

if want insert 1 alert how it, if want call function, dont know way.

to call inline javascript works

page.clientscript.registerstartupscript(gettype(), "", "<script type='text/javascript'> alert('hello');</script>"); 

try putting function name rather whole script itself.

page.clientscript.registerstartupscript(gettype(),"","foo()",true); 

or scriptmanager:

scriptmanager.registerclientscriptblock(this, this.gettype(),"","foo()",true); 

edit:

add boolean value @ end true, automatically add script tags, dont need to.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -