I\'m attempting to call a javascript method in its own file from code behind on a button click.
aspx file
protected void Next_Click(object sender, EventA
1). If the function is stored in external file (e.g. MyScript.js) then you should include it in the section of the web page and add onclick event to the button, like:
ButtonName.Attributes.Add("onclick", {YourFunction});
in Page_Load event.
2) Another approach is to assign the entire javascript function to a string variable and then pass it instead of {YourFunction} prefixed with javascript:. In this case you don't even need the external file.
Hope it will help. My best, Alex