Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how can I keep the focus on login button, when I enter the username / password?

Posted on 2011-02-28
5
Medium Priority
?
368 Views
Last Modified: 2012-05-11
so when the user hit the enter button the focus is on the login.

    <form id="form1" runat="server">
    <div>
        <div style="float: right">
            <asp:Button ID="NewUser" OnClick="NewUser_Click" Text=" New Users " runat="server"
                ToolTip="If you are a new user please click here" />
        </div>
        <br />
        <asp:Label ID="msgGeneral" BackColor="#006600" runat="server" ForeColor="White"></asp:Label><br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="UserName:"></asp:Label>&nbsp;&nbsp;
        <asp:TextBox ID="UserName" runat="server"></asp:TextBox><br />
        <br />
        <asp:Label ID="lPassword" runat="server" Text="Password:  "></asp:Label>&nbsp;&nbsp;
        <asp:TextBox ID="Password" runat="server" ToolTip="Please enter password" TextMode="Password"></asp:TextBox><br />
        <br />
        <asp:Button ID="Login" runat="server" Text="Login" OnClick="Login_Click" />
        <br />
        <br />
        <br />
    </div>
    </form>
0
Comment
Question by:goodk
5 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 35003955
0
 
LVL 40

Assisted Solution

by:Gurvinder Pal Singh
Gurvinder Pal Singh earned 500 total points
ID: 35003975
<<how can I keep the focus on login button,  when I enter the username / password?>>
you can't, since while you are typing, the focus will be on that text input control

you can simply do the submit at enter key press
http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx
0
 
LVL 8

Assisted Solution

by:Anurag Agarwal
Anurag Agarwal earned 500 total points
ID: 35004223
goodk u don't need to keep the focus on login button just make tht button as a default button which means tht whenever enter key is pressed login button will be clicked

<form id="form1" runat="server" defaultbutton="Login">

this will help u ................
0
 
LVL 17

Assisted Solution

by:selvol
selvol earned 500 total points
ID: 35006385


      <form id="form1" runat="server" defaultfocus="Button1" >

  <asp:Button ID="Button1" runat="server" Text="Button" />


Selvol
0
 

Author Closing Comment

by:goodk
ID: 35009136
thanks
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Suggested Courses

916 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