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

 Posted by vishalneeraj-24503 on 1/3/2015 | Category: ASP.NET Interview questions | Views: 2295 | 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);");


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

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response