Hi, Bob
I think you can do it through client script.
---- BEGIN CODE ----
<script type='text/javascript'>
function TextBox_onKeyPress(e, obj)
{
e = e ? e : window.event;
if (e.keyCode != 13)
return;
var oForm = obj;
while (oForm && oForm.tagName != "FORM")
oForm = oForm.parentNode;
if (oForm)
oForm.submit();
}
</script>
....
<input type='text' onkeypress='TextBox_onKeyPress(event, this)' />
---- END CODE ----
Regards,
Paulo Santos
http://pjondevelopment.50webs.com
On Nov 11, 2:43 pm, "Bob" <b...@no.erwrote:
Thanks, but unfortunately, this page is a content page linked to a
masterpage. And there is no <formin it.
"Riki" <r...@dontnagme.comschreef in berichtnews:O3**************@TK2MSFTNGP06.phx.gbl. ..
The Enter key will activate the default button on the form.
Normally, this is the first button on the form.
You can set another button as the default by setting the form's
DefaultButton property:
<form runat="server" DefaultButton="pseudoSubmit" >
Riki
Bob wrote:
Hi,
The user must enter a name into a text input control. Then i want to
give him the choice between clicking on the button with the mouse or
pushing the ENTER key of the keyboard.
This works when clicking on the button. My problem is that i don't
know how to start the sub 'pseudoserver' when pressing the ENTER key.
Here the code:
the aspx file:
------------
<input id="pseudo" type="text" onkeypress="pseudoclient(event)" />
<br />
<asp:Button ID="pseudoSubmit" runat="server" OnClick="pseudoserver" />
<script type="text/javascript">
function pseudoclient(touche)
{
var codetouche
touche=event
codetouche=touche.keyCode
if(codetouche == 13)
{
????
}
}
</script>
code-behind:
------------
Sub pseudoserver(ByVal sender As Object, ByVal e As System.EventArgs)
...
End sub
Thanks
Bob
--
Riki- Hide quoted text -
- Show quoted text -