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
Post a Comment