Today, I was tasked with making some Asp:Login and Asp:CreateUserWizard controls work. Specifically, the enter button was acting with an effluence inherent only to Asp.net: it was submitting the search button.
After playing with various schemes, I settled upon the following for the Login control:
<asp:Panel ID="pnlLogin" runat="server" DefaultButton="lgMain$LoginButton"> <asp:Login runat="server" ID="lgMain" /> </asp:Panel>
I originally thought that the same would work for the CreateUserWizard, and it turns out I was correct. But we were using a version of CssFriendlyAdapter which was slightly broken. It was outputting the buttons with one less underscore than it should have: so I made changes on lines 409 and 426 of
CreateUserWizardAdapter.cs, adding an extra underscore to the
I then used this for the registration page:
<asp:Panel runat="server" DefaultButton= "cuwMain$cogCreateUserWizard$__CustomNav0$StepNextButtonButton" > <cog:CreateUserWizard runat="server" ID="cuwMain" /> </asp:Panel>
Update 2009-06-25: today I had to do the PasswordRecovery control as well. This was a bit different because depending on what state the control was in, a different button had to be set as default.
I hooked into the events for
AnswerLookupError and set the default button to the QuestionContainer submit button, and for
UserLookupError and default set it to the default UserNameContainer button.