Solved

Login trouble

Posted on 2003-11-08
6
222 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

Industry Leaders: 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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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
Course of the Month5 days, 18 hours left to enroll

626 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