Submit button not firing on enter key press help..

Posted on 2007-10-11
Last Modified: 2008-01-09
Hello all this is a little tricky.  I have an ASPX page that loads a control within it.  The ASPX page holds the focus on a certain link button.  In the ASCX control I am using a CreateUserWizard and in that you set the button text etc like so:

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" ContinueDestinationPageUrl="~/BookWork/Protected/AuthorControlPanel.aspx?FirstLogin=true"
    DisableCreatedUser="false" Font-Names="Verdana" BackColor="white" CompleteSuccessText="The account has been successfully created.  Click the continue button to begin or wait and you will be automatically redirected to your Author Control Panel in 5 seconds."
    UnknownErrorMessage="The account was not created. Please try again." OnCreatedUser="CreateUserWizard1_CreatedUser"
    CreateUserButtonText="Create New Account!" ContinueButtonStyle-CssClass="CreateUserContinueButton">

whats happening is everytime I hit submit its going to the main ASPX page button.  I tried surrounding the ascx into a panel and form but no luck.  Also I cant use defaultbutton because it does not have an id.  I have textboxes in the wizard area and then the button just creates at the bottom of it.  Any idea how I can on enter of any textbox make sure it hits this button it creates?
Question by:sbornstein2
    LVL 5

    Expert Comment

    Hi There,

    This is a common issue, I like to add the function call as an attribute to the control when the page is loaded, of course this all depends on the context.

    There is a lot of information and code samples out there on this subject.

    Hope this helps, Sean

    Author Comment

    the issue is I dont have a ID for this button its used in the CreateUserWizard as you can see above.  How can I reference this?
    LVL 5

    Accepted Solution

    sorry, you can do this:

     open the controls's Smart Task pane, and then choose Convert to CustomNavigationTemplate.

    You should then see something like this:

     <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser">
                    <asp:CreateUserWizardStep runat="server">
                            <table border="0" cellspacing="5" style="width: 100%; height: 100%;">
                                <tr align="right">
                                    <td align="right" colspan="0">
                                        <asp:Button ID="StepNextButton" runat="server" BackColor="Green" CommandName="MoveNext"
                                            Text="Create User" ValidationGroup="CreateUserWizard1" />

                    <asp:CompleteWizardStep runat="server">
                <ContinueButtonStyle BackColor="#804000" />
                <CreateUserButtonStyle BackColor="Green" />

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    This video discusses moving either the default database or any database to a new volume.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now