Hi,
I have a query about asp.net buttons. Using asp.net 1.1 and
vb.net 2003 code I have a login screen in which customers can either register their details for the first time or existing customers can login. On the page there are two buttons. The one near the top to register and the button near the button to click for existing customers to login. Each button has a separate onclick event associated to them.
I've noted that if an existing customer puts in their login details and hits enter on the keyboard, it jumps to the new user registration screen. Its almost like they have clicked on the top button to register.
I've done some research on the web and found this code, but this does not work apparently with two buttons on the same page :
Code:
Page.RegisterHiddenField("__EVENTTARGET", "btnLogin")
Can anybody suggest how I can add some code so when you press enter it goes to the login screen. How is it best to do this ? Here's the code of how the login screen is set up :
Code:
<table cellspacing="0" cellpadding="0" width="260">
<tbody>
<tr>
<td colspan="2">
<p class="topgrid" align="center">
To place the order please login
</p>
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<div align="center">New customers please register your details :
</div>
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<asp:Button id="btnRegister" onclick="btnRegister_Click" CssClass="frmbtn" Text="Register" Width="60px" runat="server"></asp:Button>
</td>
</tr>
<tr>
<td class="linegrid" colspan="2">
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<div align="center">Returning Customer - Please login :
</div>
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<asp:Label id="lblUser" runat="server" forecolor="White">Username: </asp:Label></td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<div align="center">
<asp:TextBox id="txtUsername" Width="150px" runat="server"></asp:TextBox>
</div>
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<asp:Label id="lblPassword" runat="server" forecolor="White">Password: </asp:Label></td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<div align="center">
<asp:TextBox id="txtPassword" Width="150px" runat="server" TextMode="Password"></asp:TextBox>
</div>
</td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<asp:Label id="lblmessage" runat="server" cssclass="heading"></asp:Label></td>
</tr>
<tr>
<td class="midgrid" colspan="2">
<asp:Button id="btnLogin" onclick="btnLogin_Click" CssClass="frmbtn" Text="Login" runat="server" width="60px"></asp:Button>
</td>
</tr>
<tr>
<td class="botgrid" colspan="2">
</td>
</tr>
</tbody>
</table>
Thanks