I got an error when trying to add postback triggers for the ScriptManager control in ASP.NET by using the UpdatePanel.PostbackControls.Add method and passing in the control’s id. In my situation, I had a GridView that was wrapped in an UpdatePanel and I wanted the edit column to trigger a postback and link to another page. I received the error “A control with ID ‘ctl00_foo could not be found for the trigger in UpdatePanel ‘myUpdatePanel’.” when I tried to register the control in the postback controls collection. I got this error when passing in the ID, ClientID, and UniqueID properties of the control.
To fix this, I instead used the ScriptManager.RegisterPostbackControl() method (passing in the control itself as a parameter). If you’re using masterpages (as I was), you will need to expose the ScriptManager from the MasterPage as a public property and reference the masterpage in the client page (like so).