Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jquery, dropdown 4 38
(URGENT) Help HTML and CSS Resizing Images 2 22
Stupid git question 2 22
Re-position the objects 7 52
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now