There may be some errant spaces in the code.
How about this?
Ken
<!-------->
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function KeyDownHandler(btn)
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified
button
alert('Clicked');
btn.click();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button Runat="server" ID="DefButton" />
<asp:TextBox Runat="server" ID="FirstName"
onKeyDown="KeyDownHandler(DefButton)" />
</div>
</form>
</body>
</html>
<!-------->
"André Almeida Maldonado" <de***@bol.com.br> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
Hy Ken
I make this:
<asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
......
But when I press Enter, I receive this error:
Object doesn't suport this property or method.
WHY????? What I'm doing wrong?
Thank's
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> escreveu na
mensagem
news:OF**************@TK2MSFTNGP10.phx.gbl... http://www.dotnetspider.com/Technolo...x?SampleId=212
"André Almeida Maldonado" <de***@bol.com.br> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl... > Hey guys...
>
> In my aspx page I have a textbox that when the user press Return I need to > click a button. How can I do it???
>
> OR
>
> All the pages that contains buttons have a default button, but I don't
> know
> how to define the default button. If I do it, my problem will be
> solved.
>
>
> Thank's
>
>