Solved

Login trouble

Posted on 2003-11-08
6
221 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
[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
  • 2
  • 2
6 Comments
 
LVL 2

Assisted Solution

by:gimmeadrink
gimmeadrink earned 45 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 100 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 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