Answer: 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);");
//OR
txt_emp_first_name.Attributes.Add("onkeydown","prevent_submission();");
Abobe return code should be written inside prevent_submission() js function.
Asked In: Many Interviews |
Alert Moderator