Solved

onkeypress in c#

Posted on 2006-11-30
6
551 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:lyha_zm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Expert Comment

by:kraffay
ID: 18047366
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
 

Author Comment

by:lyha_zm
ID: 18047395
I have that function, I just want user to press enter key instand of click submit button
0
 
LVL 7

Accepted Solution

by:
vnvk earned 500 total points
ID: 18047536
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:kraffay
ID: 18047540
I think you will need to set focus to the button after they enter the password.
0
 
LVL 28

Expert Comment

by:strickdd
ID: 18047775
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
 
LVL 15

Expert Comment

by:Solar_Flare
ID: 18050969
you can also put the textbox and button in an asp:panel and set the panels defaultbutton property to be the appropriate button.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

729 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