Solved

onkeypress in c#

Posted on 2006-11-30
6
547 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
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

837 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