June 2008 - Posts - Derek Adkins

June 2008 - Posts

How to set a panel's default button to a button inside a user control

I have an interesting problem where I have a panel control on a form and in the control is a user control that contains a button.  Now I can easily get a reference to the button client ID but when I try use that as the panel.defaultbutton, it throws an error:

 The DefaultButton of 'pnlControl' must be the ID of a control of type IButtonControl.

Um.. I thought a button already implemented that interface.  And I have already checked the markup and the client ID that I am using, and they are correct.

Any ideas / solutions?   (Option B preferred.)   ;)