How to disable Enter key pressed inside TextBox to avoid submission or postback through code behind?

 Posted by vishalneeraj-24503 on 7/9/2014 | Category: ASP.NET Interview questions | Views: 2171 | Points: 40

Visual Studio gives us a warning message when we add onkeydown event.But it's just a warning so we can ignore.So to avoid this warning,we can also disable submission from code behind as:-
txt_emp_first_name.Attributes.Add("onkeydown","return (event.keyCode!=13);");


Abobe return code should be written inside prevent_submission() js function.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response