Solved

onkeypress in c#

Posted on 2006-11-30
6
552 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

615 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