Microsoft JScript runtime error: Sys.ArgumentException: An element with id ‘Form1’ could not be found.

I’ve been trying to add some Ajax to a Web Forms page.  It’s the first time I’ve used Ajax since dabbling with it when it was lauched.  I’ve had a problem:

“Microsoft JScript runtime error: Sys.ArgumentException: An element with id ‘Form1’ could not be found.
Parameter name: elementOrElementId”

I just found the solution here.  I had added a script using:

  <script src="Scripts/silverlight-detector.js" type="text/javascript" />

and when I changed it to:

  <script src="Scripts/silverlight-detector.js" type="text/javascript"></script>

it worked.  I know I’ll make this mistake again because I don’t like empty tags (uuuuuugly) and always write empty ones in the shortened form.  Since it was far from the first hit on the search, I’ve reproduced it here so I can find it again, quickly.

Advertisements