I'm assuming this is ASP.NET. If so, within your code, you call RegisterClientScriptBlock and pass it a key. But before the call, you call IsClientScriptRegistered to check whether that key has already been registered. That way, only the first user control that is added will register its javascript, so it will only be added to the page once.