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

x
?
Solved

Login trouble

Posted on 2003-11-08
6
Medium Priority
?
224 Views
Last Modified: 2010-05-03
I created a Web Application Project using VB.NET, I have a login form for users to login to the account, Now I have a username and password field for the user to fill in to enter their account, So after the user fills up the username and fills up the password field and hits enter, instead of entering the user account the page is reloaded, as in user accounts usually after filling up the password the user hits enter instead of clicking on the login button with the mouse.....so why does my application not work the way it usually does, like after filling the password field the user clicks enter and then enters his account....



Please ask if someone did not understand my question or needs more information....


0
Comment
Question by:Moizsaif123
  • 2
  • 2
5 Comments
 
LVL 2

Assisted Solution

by:gimmeadrink
gimmeadrink earned 180 total points
ID: 9708914
Can you post the code for the form. Its hard to work out what is wrong without it.

ta
0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 9709750
My problem has the same concept as in the Login page in this website,
http://www.experts-exchange.com, when I fill in my user name and password ,I do not have to manually use the mouse to click Login, I can hit enter and the user logins the page.....In .NET on the other hand if I hit enter instead of using the mouse to click the Login button the page reloads......I will post my code .....
0
 
LVL 5

Accepted Solution

by:
fantasy1001 earned 400 total points
ID: 9712527
You have to set the default to your submit button. The Login button should set to the submit type.

~ fantasy ~
0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 9715145
fantasy1001,

My Html code is,and the Id of my Login button is ,'Submit1'....



<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Login.aspx.vb" Inherits="Patients_Web_Proj.Login"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>WebForm2</title>
            <meta content="True" name="vs_showGrid">
            <meta content="False" name="vs_snapToGrid">
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <SCRIPT language="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- John Munn  (jrmunn@home.com) -->

<!-- Begin
 function putFocus(formInst, elementInst) {
  if (document.forms.length > 0) {
   document.forms[formInst].elements[elementInst].focus();
  }
 }
// The second number in the "onLoad" command in the body
// tag determines the form's focus. Counting starts with '0'
//  End -->
            </SCRIPT>
      </HEAD>
      <body bgColor="#d9e5ff" topMargin="50" onload="putFocus(0,1);" MS_POSITIONING="GridLayout">
            <form id="Form1" name="testForm" runat="server">
                  &nbsp;
                  <asp:panel id="Panel2" style="Z-INDEX: 101; LEFT: 0px; POSITION: absolute; TOP: 0px" runat="server" BorderWidth="8px" BackColor="LightSteelBlue" BorderColor="CornflowerBlue" BorderStyle="Outset" Height="46px" Width="992px">
                        <FONT style="BACKGROUND-COLOR: #c0ffff"></FONT>
                  </asp:panel><asp:label id="Lbl_PtnDemo" style="Z-INDEX: 102; LEFT: 438px; POSITION: absolute; TOP: 12px" runat="server" BackColor="LightSteelBlue" Height="21px" Width="51px" Font-Italic="True" Font-Size="Medium" Font-Bold="True">Login </asp:label>&nbsp;
                  <asp:panel id="Panel1" style="Z-INDEX: 103; LEFT: 286px; POSITION: absolute; TOP: 132px" runat="server" BackColor="ActiveBorder" BorderColor="ActiveCaption" BorderStyle="Groove" Height="205px" Width="368px">
                        <P>&nbsp;</P>
                        <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
                        <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
                  </asp:panel><asp:textbox id="TBUsrName0" style="Z-INDEX: 104; LEFT: 404px; POSITION: absolute; TOP: 168px" tabIndex="1" runat="server" Height="24px" Width="178px"></asp:textbox><asp:textbox id="TB_Password" style="Z-INDEX: 105; LEFT: 405px; POSITION: absolute; TOP: 217px" tabIndex="2" runat="server" Height="24px" Width="178px" TextMode="Password"></asp:textbox><asp:button id="Button2" style="Z-INDEX: 106; LEFT: 495px; POSITION: absolute; TOP: 260px" runat="server" Height="23px" Width="104px" Text="Cancel"></asp:button><INPUT id="Submit1" style="Z-INDEX: 107; LEFT: 354px; WIDTH: 112px; POSITION: absolute; TOP: 260px; HEIGHT: 23px" onclick="document_onclick()" tabIndex="2" type="submit" value="Submit" name="Submit1" runat="server">
                  <a href="http://10.32.0.76/Patients-Web-Proj/Demo_Ptn.aspx">
                        <asp:linkbutton id="LinkButton1" style="Z-INDEX: 108; LEFT: 540px; POSITION: absolute; TOP: 305px" runat="server" BackColor="ActiveBorder" Height="18px" Width="102px" Font-Italic="True" Font-Names="Estrangelo Edessa">New Patient</asp:linkbutton></a><asp:label id="Label1" style="Z-INDEX: 109; LEFT: 318px; POSITION: absolute; TOP: 170px" runat="server" BackColor="ActiveBorder" Height="20px" Width="72px" Font-Names="Arial Narrow">UserName</asp:label><asp:label id="Label2" style="Z-INDEX: 110; LEFT: 326px; POSITION: absolute; TOP: 220px" runat="server" BackColor="ActiveBorder" Height="20px" Width="72px" Font-Names="Arial Narrow">Password</asp:label></form>
      </body>
</HTML>
0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9718896
Simply add the following line to your page's Load event, replacing "btnSearch" with the name of your button. It uses a hidden Page method called RegisterHiddenField and works splendidly:

Page.RegisterHiddenField("__EVENTTARGET", "Submit1")

~ fantasy ~
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

824 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