Setting Focus in Web User Control that Uses AJAX Update Panel

Discussion in 'ASP .Net Web Controls' started by Colin Halliday, Apr 24, 2007.

  1. 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.

    --
    Colin Halliday
     
    Colin Halliday, Apr 24, 2007
    #1
    1. Advertising

  2. 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 (, 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.
     
    Walter Wang [MSFT], Apr 24, 2007
    #2
    1. Advertising

  3. Many thanks - that solves my problem perfectly.

    Colin


    "Walter Wang [MSFT]" <> wrote in message
    news:...
    > 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 (, 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.
    >
     
    Colin Halliday, Apr 24, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    4
    Views:
    1,683
    Jason
    May 7, 2007
  2. William LaMartin
    Replies:
    0
    Views:
    438
    William LaMartin
    May 24, 2007
  3. Ulf Meinhardt
    Replies:
    0
    Views:
    646
    Ulf Meinhardt
    Jul 7, 2009
  4. Robin Wenger
    Replies:
    0
    Views:
    2,988
    Robin Wenger
    Aug 18, 2011
  5. Roger
    Replies:
    3
    Views:
    379
Loading...

Share This Page