From an extrnal Javascript file, I need to check for IsPostBack (ASP.NET page). Here is what I found after googling:
var isPostBack = <%= Page.IsPostBack ? "true" : "false" %>;
But <%= %> doesn’t seem to be recognized in the external JS file. If so, what is the alternate solution?
You won’t be able to do that from an external file. Even if you could, external files get cached on the client’s browser, and they don’t get pulled every time. You might be able to place a function in the page and call it from the external script.
External Script
ASPX Page (Script in header)
Just make sure that your external script gets loaded after the above line in the page.