I struggled with this for about a day, and there were a lot of sites saying I should just use button.ID or button.UniqueID to set the default button for a panel. Nope, that wasn’t working. Some users were complaining the issue was only occurring on setting default button when in a control contained in a Master page.
The error would be:
The DefaultButton of panel or page must be the ID of a control of type IButtonControl.
So, here’s what you do to fix it:
// Set the default buttons.
((Panel)Page.FindControl(nameofthepanel.UniqueID)).DefaultButton = nameofthebutton.ID;
I hope that helps