hitting enter does not submit form but refreshes page?

Discussion in 'ASP .Net Web Controls' started by Abraham Luna, Sep 2, 2005.

  1. Abraham Luna

    Abraham Luna Guest

    i am using a master and content page
    the regular aspx page not attached to a master page will submit when the
    user hits enter

    how come a content page will not submit if the user hits enter?
    Abraham Luna, Sep 2, 2005
    #1
    1. Advertising

  2. Abraham Luna

    Brock Allen Guest

    You need to use the <form defaultbutton="IDOfAButton"> or the HtmlForm.DefaultButton
    property.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > i am using a master and content page
    > the regular aspx page not attached to a master page will submit when
    > the
    > user hits enter
    > how come a content page will not submit if the user hits enter?
    >
    Brock Allen, Sep 4, 2005
    #2
    1. Advertising

  3. Abraham Luna

    Abraham Luna Guest

    thank you for your answer brock.

    i set the defaultbutton in the page_load event. i get an error:

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

    i think it's because i use a usercontrol:

    <RDK:RDK_BaseButton ID="btnSearch" Text="Search" runat="server"
    OnClick="btnSearch_Click" />

    what can i do to get .net to recognize that it is really a button?

    thank you.

    "Brock Allen" <> wrote in message
    news:...
    > You need to use the <form defaultbutton="IDOfAButton"> or the
    > HtmlForm.DefaultButton property.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> i am using a master and content page
    >> the regular aspx page not attached to a master page will submit when
    >> the
    >> user hits enter
    >> how come a content page will not submit if the user hits enter?
    >>

    >
    >
    >
    Abraham Luna, Sep 6, 2005
    #3
  4. Abraham Luna

    Brock Allen Guest

    You need the ID of the Button inside your custom control. The UniqueID property
    is the string you want to use when the Button is nested inside other controls.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > thank you for your answer brock.
    >
    > i set the defaultbutton in the page_load event. i get an error:
    >
    > The DefaultButton of '' must be the ID of a control of type
    > IButtonControl.
    >
    > i think it's because i use a usercontrol:
    >
    > <RDK:RDK_BaseButton ID="btnSearch" Text="Search" runat="server"
    > OnClick="btnSearch_Click" />
    >
    > what can i do to get .net to recognize that it is really a button?
    >
    > thank you.
    >
    > "Brock Allen" <> wrote in message
    > news:...
    >
    >> You need to use the <form defaultbutton="IDOfAButton"> or the
    >> HtmlForm.DefaultButton property.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> i am using a master and content page
    >>> the regular aspx page not attached to a master page will submit when
    >>> the
    >>> user hits enter
    >>> how come a content page will not submit if the user hits enter?
    Brock Allen, Sep 6, 2005
    #4
  5. Abraham Luna

    Marius Guest

    I have the same scenario where I have a user control that contains an image
    button in ASP.Net 2.0 beta 2. Setting the 'DefaultButton' of a panel or form
    to the unique ID of the image button within the user control does not work
    for me. I keep getting the message about the control has to implement
    iButtonControl.

    Do you have any further information to assist in this matter?

    "Brock Allen" wrote:

    > You need the ID of the Button inside your custom control. The UniqueID property
    > is the string you want to use when the Button is nested inside other controls.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    > > thank you for your answer brock.
    > >
    > > i set the defaultbutton in the page_load event. i get an error:
    > >
    > > The DefaultButton of '' must be the ID of a control of type
    > > IButtonControl.
    > >
    > > i think it's because i use a usercontrol:
    > >
    > > <RDK:RDK_BaseButton ID="btnSearch" Text="Search" runat="server"
    > > OnClick="btnSearch_Click" />
    > >
    > > what can i do to get .net to recognize that it is really a button?
    > >
    > > thank you.
    > >
    > > "Brock Allen" <> wrote in message
    > > news:...
    > >
    > >> You need to use the <form defaultbutton="IDOfAButton"> or the
    > >> HtmlForm.DefaultButton property.
    > >>
    > >> -Brock
    > >> DevelopMentor
    > >> http://staff.develop.com/ballen
    > >>> i am using a master and content page
    > >>> the regular aspx page not attached to a master page will submit when
    > >>> the
    > >>> user hits enter
    > >>> how come a content page will not submit if the user hits enter?

    >
    >
    >
    >
    Marius, Oct 26, 2005
    #5
  6. finally got it to work:

    if (!IsPostBack)
    {
    this.Form.DefaultButton = btnSearch.UniqueID;
    }



    "Marius" <> wrote in message
    news:D...
    >I have the same scenario where I have a user control that contains an image
    > button in ASP.Net 2.0 beta 2. Setting the 'DefaultButton' of a panel or
    > form
    > to the unique ID of the image button within the user control does not work
    > for me. I keep getting the message about the control has to implement
    > iButtonControl.
    >
    > Do you have any further information to assist in this matter?
    >
    > "Brock Allen" wrote:
    >
    >> You need the ID of the Button inside your custom control. The UniqueID
    >> property
    >> is the string you want to use when the Button is nested inside other
    >> controls.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>
    >>
    >>
    >> > thank you for your answer brock.
    >> >
    >> > i set the defaultbutton in the page_load event. i get an error:
    >> >
    >> > The DefaultButton of '' must be the ID of a control of type
    >> > IButtonControl.
    >> >
    >> > i think it's because i use a usercontrol:
    >> >
    >> > <RDK:RDK_BaseButton ID="btnSearch" Text="Search" runat="server"
    >> > OnClick="btnSearch_Click" />
    >> >
    >> > what can i do to get .net to recognize that it is really a button?
    >> >
    >> > thank you.
    >> >
    >> > "Brock Allen" <> wrote in message
    >> > news:...
    >> >
    >> >> You need to use the <form defaultbutton="IDOfAButton"> or the
    >> >> HtmlForm.DefaultButton property.
    >> >>
    >> >> -Brock
    >> >> DevelopMentor
    >> >> http://staff.develop.com/ballen
    >> >>> i am using a master and content page
    >> >>> the regular aspx page not attached to a master page will submit when
    >> >>> the
    >> >>> user hits enter
    >> >>> how come a content page will not submit if the user hits enter?

    >>
    >>
    >>
    >>
    Abraham Andres Luna, Oct 27, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. 23s
    Replies:
    2
    Views:
    3,903
  2. Megha Vishwanath
    Replies:
    2
    Views:
    9,818
    tutorialsmaster
    Oct 2, 2009
  3. Sunfire
    Replies:
    2
    Views:
    1,056
    Sunfire
    Nov 6, 2007
  4. Guest
    Replies:
    2
    Views:
    1,575
    Guest
    Oct 25, 2004
  5. Megha Vishwanath
    Replies:
    3
    Views:
    699
    Megha Vishwanath
    Jul 20, 2004
Loading...

Share This Page