Hi,
In the aspx webform, I can put this:
--- Javascript in ASPX:
function methodCompleted(results, context, methodName) {
$get("<%=Button1.ClientID%>").disabled = false;
$get("<%=lblHora.ClientID%>").innerHTML = results.toString();
}function getTimeBtnClicked(sender) {
sender.disabled = true;
PageMethods.GetTime(methodCompleted);
}---- HTML in ASPX:
[WebMethod]
public static DateTime GetTime()
{
return DateTime.Now;
}
And it works, I mean, I get the clientId of the server controls in runtime.
But the same code, in a external .js file, doesn't work.
Question 1
Obviuosly I prefer to have the javascript code on external .js files, it is possible to use <%=%> in a external .js file and execute it as a server side code?
Question 2
Is it possible to pass information of the sender object to the "methodCompleted" callback as a parameter?
Thanks!