Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have this script on my login page where there are two textboxes that collect username and password:

 

<SCRIPT LANGUAGE="javascript">
if (document.all)
{ 
     document.onkeydown = function ()
     {			
         var key_enter= 13; 
         if (key_enter==event.keyCode)
         {
              document.getElementById('LinkButton1').click()
         }
     }
}
</SCRIPT>

 

I also have an event that handles the linkbutton1.click event in the code behind. I've got two questions...Why is it beeping when I press enter? And the second is the password dissapears when I tab over to linkbutton1. Anyone know why?

Codeless

...it just goes on and on.

Posted

I don't know C#, and I don't know ASP.Net, but in VB.Net for Windows Forms, this is what you have to do to remove the beep:

Public Sub TextBox_Keypress(ByVal sender As Object, ByVal e As System.KeyPressEventArgs) 'or w/e it should be

If convert.tochar(keys.enter) = e.keychar then
   'do whatever here
   e.Handled = True 'removes the beep
End If

End Sub

Posted
Thanks for taking the time to respond. However, ASP doesn't have 'handled' as a system event argument. Thanks though!

Codeless

...it just goes on and on.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...