setfocus and select text in a textbox

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5kcmV3?=, Apr 12, 2006.

  1. hi all,

    I have a webform that I would like do add some features.
    How do I :
    1) setfocus in a textbox when the page first loads up; and also dynamically
    when I want to focus on it.
    2) highlight the text in a textbox.

    TIA.
    regards,
    andrew
     
    =?Utf-8?B?QW5kcmV3?=, Apr 12, 2006
    #1
    1. Advertising

  2. I don't know how to highlight the text in a text box but to set the focus on
    it you just call the focus method. e.g. MyTextBox.Focus();

    "Andrew" wrote:

    > hi all,
    >
    > I have a webform that I would like do add some features.
    > How do I :
    > 1) setfocus in a textbox when the page first loads up; and also dynamically
    > when I want to focus on it.
    > 2) highlight the text in a textbox.
    >
    > TIA.
    > regards,
    > andrew
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 12, 2006
    #2
    1. Advertising

  3. i am refering to a webform on asp.net 1.1. I don't think there is a focus()
    for a textbox server control.

    "clickon" wrote:

    > I don't know how to highlight the text in a text box but to set the focus on
    > it you just call the focus method. e.g. MyTextBox.Focus();
    >
    > "Andrew" wrote:
    >
    > > hi all,
    > >
    > > I have a webform that I would like do add some features.
    > > How do I :
    > > 1) setfocus in a textbox when the page first loads up; and also dynamically
    > > when I want to focus on it.
    > > 2) highlight the text in a textbox.
    > >
    > > TIA.
    > > regards,
    > > andrew
     
    =?Utf-8?B?QW5kcmV3?=, Apr 12, 2006
    #3
  4. oh right, there is in ASP.net 2.0, i didn't realise it was a new method.

    "Andrew" wrote:

    > i am refering to a webform on asp.net 1.1. I don't think there is a focus()
    > for a textbox server control.
    >
    > "clickon" wrote:
    >
    > > I don't know how to highlight the text in a text box but to set the focus on
    > > it you just call the focus method. e.g. MyTextBox.Focus();
    > >
    > > "Andrew" wrote:
    > >
    > > > hi all,
    > > >
    > > > I have a webform that I would like do add some features.
    > > > How do I :
    > > > 1) setfocus in a textbox when the page first loads up; and also dynamically
    > > > when I want to focus on it.
    > > > 2) highlight the text in a textbox.
    > > >
    > > > TIA.
    > > > regards,
    > > > andrew
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 12, 2006
    #4
  5. anyone else able to assist me. all suggestions are welcomed.

    "clickon" wrote:

    > oh right, there is in ASP.net 2.0, i didn't realise it was a new method.
    >
    > "Andrew" wrote:
    >
    > > i am refering to a webform on asp.net 1.1. I don't think there is a focus()
    > > for a textbox server control.
    > >
    > > "clickon" wrote:
    > >
    > > > I don't know how to highlight the text in a text box but to set the focus on
    > > > it you just call the focus method. e.g. MyTextBox.Focus();
    > > >
    > > > "Andrew" wrote:
    > > >
    > > > > hi all,
    > > > >
    > > > > I have a webform that I would like do add some features.
    > > > > How do I :
    > > > > 1) setfocus in a textbox when the page first loads up; and also dynamically
    > > > > when I want to focus on it.
    > > > > 2) highlight the text in a textbox.
    > > > >
    > > > > TIA.
    > > > > regards,
    > > > > andrew
     
    =?Utf-8?B?QW5kcmV3?=, Apr 12, 2006
    #5
  6. =?Utf-8?B?QW5kcmV3?=

    Joined:
    Jun 11, 2007
    Messages:
    1
    Use this one.
    txtbox1.Focus();
    txtbox1.Attributes.Add("onfocusin", " select();");
     
    , Jun 11, 2007
    #6
    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. jamess

    asp setfocus and performance

    jamess, Oct 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    444
    Saravana [MVP]
    Oct 30, 2003
  2. JC
    Replies:
    2
    Views:
    9,348
  3. john22
    Replies:
    0
    Views:
    601
    john22
    Nov 6, 2007
  4. Robin Prosch via .NET 247

    setfocus on mobile textbox for barcode scanning

    Robin Prosch via .NET 247, Jul 3, 2004, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    651
    Robin Prosch via .NET 247
    Jul 3, 2004
  5. niv

    setfocus textbox

    niv, Oct 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    110
Loading...

Share This Page