ASP.net Prevent postback when GridView  Template TextBox is clicked

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

In an ASP.net GridView template column if I hit Enter it causes a postback.
Is there a way to prevent this?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer User Interface
Commented:
There is no property in the textbox that will let you do that. You would have to write a workaround something like this.

<asp:TextBox ID="TextBox1" runat="server"  onkeydown = "return (event.keyCode!=13);" >

</asp:TextBox>

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial