| re: Enter Press on Text box ASP.Net
you can use JavaScript to do this.
Add this code to you TextBox (Where tbMyTextBox is the name of your textbox)
tbMyTextBox.Attributes.Add("onkeydown", "if ((event.which && event.which ==
13) || (event.keyCode && event.keyCode == 13))
{document.Form1.elements['tbMyTextBox].click();return false;} else return
true; ");
HTH
"csgraham74" <csgraham74@hotmail.com> wrote in message
news:1127823326.738444.55560@g49g2000cwa.googlegro ups.com...[color=blue]
> Hello,
>
> I wonder if someone could help me.
>
> I have an asp.net form which collects data from a piece of XML and
> displays it on screen. If a piece of data is incorrect i will select
> the textbox and change the data. If i press enter whilst in the text
> box it throws an event.
>
> My question is how do i disable the event or autopostback of the form
> when the enter key is pressed whilst in a textbox.
>
> any help greatly appreciated.
>
> CG
>[/color] |