ASP.NET 2.0 provides a method ClientScript.RegisterClientScriptBlock()for registering JavaScript on an ASP.NET page.
The problem I encountered is passing the script when it is in another directory. In particular, the following syntax does not work:
ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", "../dir/subdir/scriptName.js", true);
Instead of dropping the code onto the page, for example this page says that it should, instead displays ../dir/subdir/script.js, my question is this:
Has anyone talked about this before and found a way to drop javascript in a separate file? Am I going about it wrong?
source
share