Asp.Net AutoPostback and control focus

Discussion in 'ASP .Net Web Controls' started by robin9876@hotmail.com, Jun 21, 2006.

  1. Guest

    In Asp.Net v1.1 web form I have a number of controls which have the
    autopostback enabled. Is it possible after the autopostback has run
    that the control that caused the autopostback to get the focus?
     
    , Jun 21, 2006
    #1
    1. Advertising

  2. I am not sure if there is a built-in way to do that, but you could generate
    JavaScript that runs right away (not a function) that calls the focus()
    method of the appropriate control. To do this, try using the following:


    TextBox2.Page.RegisterClientScriptBlock("refocus", "<script
    type=""text/javascript"">" & TextBox2.ClientID & ".focus();</script>")


    I have not tested this code, but I would expect that it would work. Good
    Luck!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    <> wrote in message
    news:...
    > In Asp.Net v1.1 web form I have a number of controls which have the
    > autopostback enabled. Is it possible after the autopostback has run
    > that the control that caused the autopostback to get the focus?
    >
     
    Nathan Sokalski, Jun 23, 2006
    #2
    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. Mad Scientist Jr
    Replies:
    2
    Views:
    5,292
    Mad Scientist Jr
    Jun 29, 2004
  2. Replies:
    1
    Views:
    2,087
    =?Utf-8?B?QmVudCBLcmlzdGlhbnNlbg==?=
    Jun 21, 2006
  3. Jason
    Replies:
    4
    Views:
    1,632
    Jason
    May 7, 2007
  4. Pai

    AutoPostBack and Focus...

    Pai, Nov 12, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    123
    susie
    Nov 14, 2003
  5. Roger
    Replies:
    3
    Views:
    336
Loading...

Share This Page