html - Set Focus to a textbox after data validation in .ASP page -


I am working on an asp page which verifies the information in the text box after which the user types in.

A "product number" has been entered manually (using the free form) after updating event, data has been posted to me and to determine whether it is valid , To see the product number. If not valid, an error message has been posted in the box, otherwise the product number and description are placed in the box (IE X1234 becomes X1234 - RED YO-YO). It works 100% fine. My problem is that after the update the focus on all data entry items has been lost. I want the focus to be returned to the next text box so that the operator can type in the next part of the required information.

Note: By now I have inserted a function that dynamically changes the "TABSTOP" numbering, such as the "Next" box assigned to # 1 after verification verification. It works on my browser (Firefox 3.05), but not on my IE (Thanks Bill!). When in IE, when the posting is finished, focus on "Enter URL" for some reasons ends and focuses on some control buttons, where no one is where I want to.

If you are trying to do me, then you should do it.

In your ASPX page:

  & lt; Script type = "text / javascript" & gt; Function Focus Control (ctrlId) {document.getElementById (ctrlId). Focus (); } & Lt; / Script & gt;  

Your code-behind:

  // 'ctrl' is the name of the ASP.NET textbox that you want to focus on // Weight . Page Client script. Registry startup script (typef (page), "focuser", "focus control ('" + ctrl.ClientID + "' ');" true ");  

Comments