Solved

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

Posted on 2011-02-28
5
363 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
[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
5 Comments
 
LVL 82

Accepted Solution

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

Assisted Solution

by:gurvinder372
gurvinder372 earned 125 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 125 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 125 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

738 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