onkeypress in c#

I have a page like a login page, after the user provide the name and password, then press  enter button, I wish them can go to another page, how can I do that?

Thanks

lyha
lyha_zmAsked:
Who is Participating?
 
vnvkCommented:
http://www.dotnetwatch.com/display.aspx?contID=48
http://www.dotnetwatch.com/ASP.NET.aspx

The above url defines a way to add a new attribute to the text box control.
0
 
kraffayCommented:
Try this:

    protected void btnLogin_Click(object sender, EventArgs e)
    {
           
        Response.Redirect ("MyPage.aspx");
       
    }

Make sure your button calls the sub:

<asp:Button ID="btnLogin" runat="server" OnClick="btnLogin_Click" Text="Button" />
0
 
lyha_zmAuthor Commented:
I have that function, I just want user to press enter key instand of click submit button
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
kraffayCommented:
I think you will need to set focus to the button after they enter the password.
0
 
strickddCommented:
By default the first <asp:Button> is the "Submit" button and will be executed when the user hits "Enter". What you can do is change preceeding <asp:Button>'s to be <input type="Button" ID="SomeButton" runat="server">
0
 
Solar_FlareCommented:
you can also put the textbox and button in an asp:panel and set the panels defaultbutton property to be the appropriate button.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.