TextField SetFocus

I am having some issues trying to set the focus of textfields via code.

I have a page and on the open event I load a bunch of container controls that are all the same. Basically just a label and textfield in the container. I have code in the textfield on the container that validates the entry made and would like to set the focus to the next textfield in the next container. I do this via some code calling to the page where I did the embedwithin method of the containers like this:


The myidx variable is one I track within the container against the property on my page. Basically the code somewhat works but just seems to lose focus of the current field but never sets the focus of the next one in my index.

What is the best way to handle doing something like this?

I also think that the code from my container trying to access items on the page are somewhat of an issue. Is this the way one would handle doing this?


me.Page is the webpage the container is in, so you can cast that to a TestPage and access the mQuestions array.