Ajax Update Panel & losing focus on textboxes

Hi,

I have a search page with numerous criteria but for the sake of example lets assume it only contains Surname and First Name textboxes.  In addition i have a "Search Criteria" section on the page which updates with what you are searching on.

All the search boxes are contained within an update panel with the textboxes set to AutoPostback.  When you enter criteria in a textbox and then click elsewhere the search criteria updates as required.

The problem is that if i enter something in surname and then click the firstname textbox the search criteria updates as expected but due to the partial postback (i'm assuming) the firstname textbox dosent retain focus.

Does anybody know of a workaround for this behaviour?

Many thanks,

Stu.
stu_billAsked:
Who is Participating?
 
MarcGraffConnect With a Mentor Commented:
You could add a JavaScript variable and set it for when the user is in the field. Then when your page returns use a ScriptManager.RegisterStartupScript to check the bit in the variable and set focus if necessary.

A little messy but should work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.