Solved

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

Posted on 2011-02-28
5
362 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

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!

Question has a verified solution.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

763 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