The most likely cause is that you're using a master page, which causes the IDs to be mangled.
Mastering Web Control ClientID Values in ASP.NET 4 - 4GuysFromRolla.com
If there will only ever be a single instance of the control on the page, set
on your control.
If the script is embedded within the page, reference the control's
Otherwise, you'll need to find another way to reference the control.