Answer: In textbox definition,we have to write below code on onkeydown event as:-
<asp:TextBox ID="txt_emp_first_name" runat="server" onkeydown = "return(event.keyCode!=13);"></asp:TextBox>
Here,13 is keyboard Enter button key code.
When enter key is pressed the above condition is false hence false is returned therefore the postback will be disabled.
Asked In: Many Interviews |
Alert Moderator