Thursday, October 11, 2007

Ajax and form doesn't work when setting focus

I had this issue on a registration form. Each time the person typed in a value, we checked for an error. This caused a postback to occur which validated the text. Problem was the input box would lose focus. My initial thought was to set the focus in the codebehind. After some research, there is a different solution:

Key to this whole issue: When Ajax does a postback, it completely rewrites the html for that portion. I had to take my individual text boxes out of one updatepanel and put it into multiple.

See a great description on it here: http://forums.asp.net/p/1062555/1529151.aspx

No comments: