?
Solved

Ajax Update Panel & losing focus on textboxes

Posted on 2009-04-22
1
Medium Priority
?
1,073 Views
Last Modified: 2013-11-08
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.
0
Comment
Question by:stu_bill
1 Comment
 
LVL 1

Accepted Solution

by:
MarcGraff earned 500 total points
ID: 24210801
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question