Ugly, but working - feedback please !! - "again!" & "again" "ENTER" key to a button

Ugly, but working - feedback please !! - "again!" & "again" "ENTER" key to a button

Post by Varadh » Sat, 16 Feb 2002 09:20:51

This is for Version 1 of DotNet Framework !!??

After going thru every post about this in almost all the newsgroups, none of
them worked for me...

So, here's an Ugly ! Solution to my problem of multiple Buttons
with(corresponding) multiple Textboxes..
When the user enters values in the textbox and press enter the corresponding
button fires ...

1. The two things I needed was a Html:Textbox (not asp:textbox)(called
TBPassword) and run this as server control (runat = server) so I can access
this textbox both in client and server side.

1a. In the TBPassword Html Code --- > I've added the following
<Input onkeypress=checkEnter(1,event) id=TBPassword runat=server>

-----------> for other textboxes we can enter chcekEnter(2,event) etc...

2. The second on is an HTML:Hidden Text box (also runat= server) --> called

3. Plus I have a regular asp:button (LBLogin) and myy Form Name is SMLogin

4. <script language="JavaScript">
function checkEnter(id,event)
 if (event.keyCode==13)  // Corresponds to ENTER KEY
  SMLogin.TBHidden.value = id;
  SMLogin.TBHidden.value = 0;



In the the codebehing (SMLogin.aspx.cs) Page_Load, I'm checking the

        case 1:
                LBLogin_Click(this,e); // calling the button_Click Event

        case 2 :
                //Second Button click Event;


This works fine and now I can go on think about other problems .... Unless
someone comes and post
a modifed (codebehing only code !!) that works for Version 1

or Look Microsoft... your ASP.NET Cannot solve a simple problem ??!!