Claudio, have a look at Andy Smith's free DefaultButtons control at
http://www.metabuilders.com/Tools/DefaultButtons.aspx
It makes it easy to assign the <enter> keypress to a control that has
the
focus.
While you're there, look around for some other fine controls, all at the
same low price (free).
HTH
-----Original Message-----
From: Claudio Pallone [mailto:claudio.pallone@k...]
Sent: Friday, March 14, 2003 7:45 PM
To: ASPX_Professional
Subject: [aspx_professional] DETECTING THE ENTER KEY (PRESSS)
Hi,
I saw Piyush message below and it helped me a lot. Thanks.
However, in my case, the event I would like to use is the pressing of a
key on the keyboard. So suppose the user enter some text on a text box.
When he presses the enter key, I would like to call a javascript
function.
In your example you show us how to achieve that with an <asp:LinkButton
>.
How can I do the same with the enter key??
Cheers,
Claudio
> Hi,
I understand, You won't be able to directly call a client side function
on a
Server side event.
Instead it can be done like this:
<script language=3D"javascript">
<!--//
function OpenWindow(psUrl)
{
window.open(psUrl);
}
//-->
</script>
<asp:LinkButton id=3D"LinkButton1" style=3D"Z-INDEX: 110; LEFT: 559px;
POSITION: absolute; TOP: 111px"
runat=3D"server">LinkButton</asp:LinkButton>
Adding this line in Page_load function will tie the function name to the
onclick event in html rendered in browser:
LinkButton1.Attributes.Add("onclick","ClientSideFunc()");
I hope this helps,
Regards,
Piyush
Piyush_prakash@i...