Setting Focus in Web User Control that Uses AJAX Update Panel

C

Colin Halliday

I have created a Web User Control (wuc) that incorporates an Update Panel.
I originally used a ScriptManager control within this but found that, when I
included the wuc on a page that had other Update Panels, I could not have
more than one ScriptManager on the resultant page.

So I changed the wuc to include a SriptManagerProxy instead of a
ScriptManager. Fine.

However the wuc originally included some code to set focus on the correct
control within itself such as:
me.scriptmanager.setfocus("me.txtBox2")

This worked fine until I had to replace the scriptmanager with the
scriptmanagerproxy.

The proxy has no setfocus method.

I tried the proxy.findcontrol("txtBox2").focus but this does not work!

Any help on how to control the focus within a wuc that uses an update panel
and scriptmanagerproxy would be greatly appreciated.

Thanks.
 
W

Walter Wang [MSFT]

Hi Colin,

Please use the static method ScriptManager.GetCurrent() to get the instance
of ScriptManager on a page:

ScriptManager.GetCurrent(Me.Page).SetFocus(me.txtBox2)


Hope this helps.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top