c# - Calling a Javascript function from ASP.NET code-behind that is not inline JS -
i've found many examples of people calling inline js functions in html pages, i'm wondering if possible call js functions in own file.
for example if have ~/scripts/mainjs.js house of our javascript functions, there way call functions in file c# code-behind?
edit: preferably passing parameters js function
try this
string jsfunc = string.format("myfunction('{0}');", parametervalue); scriptmanager.registerstartupscript(this.page, page.gettype(), "myjsfn", jsfunc, true);
write in aspx.cs file here myfunction function name , parametervalue argument.
Comments
Post a Comment