Selecting all text in a textbox?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Selecting all text in a textbox?

    I've got a server-side textbox that receives the focus when the page loads.
    It has the text "Refine your Search" in the textbox. Obviously the user
    needs to highlight the "Refine your Search" section to replace this with
    thier text.

    I've googled and found javascript (which doesn't seem to work with the
    server side control).

    Is there a way to do this with ASPNET??

    TIA
    Harry


    Harry Simpson Guest

  2. Similar Questions and Discussions

    1. Problem with selecting text
      Hi all- I just created a business card design and went to convert the text to outlines before uploading to my prepress for a quote. I went to...
    2. Selecting Text Frames
      Hello everyone, Is there a way to select all the text frames in a publication so I can change them all at once to Leading instead of Baseline in...
    3. Selecting text problems
      I have a project where I need to copy the text from old PDFs and put them into a word document. Unfortunately, I think the text is actually saved as...
    4. Having trouble selecting text in Illustrator CS
      I'm having trouble selecting text in Illustrator CS. When selecting type with the type tool it selects nearby paths instead. When using the same...
    5. Highlighting, Underlining, Selecting Text
      It seems that I cannot use any of these features in documents I created from my scanner in Adobe Acrobat 5.0. How can I get these to work? Is there a...
  3. #2

    Default Re: Selecting all text in a textbox?

    Hi,

    you should be able to use JScript with ASP.NET just fine, in fact you need
    JScript to do what you want. What was the problem with the Jscript in
    combination with ASP.NET?

    Best regards,

    Marc Höppner
    NeoGeo

    "Harry Simpson" <hssimpson@nospamphgt.net> wrote in message
    news:OvHWwrRVDHA.3232@tk2msftngp13.phx.gbl...
    > I've got a server-side textbox that receives the focus when the page
    loads.
    > It has the text "Refine your Search" in the textbox. Obviously the user
    > needs to highlight the "Refine your Search" section to replace this with
    > thier text.
    >
    > I've googled and found javascript (which doesn't seem to work with the
    > server side control).
    >
    > Is there a way to do this with ASPNET??
    >
    > TIA
    > Harry
    >
    >

    Marc Hoeppner Guest

  4. #3

    Default Re: Selecting all text in a textbox?

    Thanks Marc,

    I got it working:

    Added this to the codebehind load of screen:
    txtSearchText.Attributes.Add("onfocus", "SetSelected();")

    Then add this to the html of the aspx page:

    function SetSelected()
    {
    document.Form1.txtSearchText.select();
    }

    Thanks for the reply
    Harry

    "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
    news:ey8Kd5RVDHA.2004@TK2MSFTNGP11.phx.gbl...
    > Hi,
    >
    > you should be able to use JScript with ASP.NET just fine, in fact you need
    > JScript to do what you want. What was the problem with the Jscript in
    > combination with ASP.NET?
    >
    > Best regards,
    >
    > Marc Höppner
    > NeoGeo
    >
    > "Harry Simpson" <hssimpson@nospamphgt.net> wrote in message
    > news:OvHWwrRVDHA.3232@tk2msftngp13.phx.gbl...
    > > I've got a server-side textbox that receives the focus when the page
    > loads.
    > > It has the text "Refine your Search" in the textbox. Obviously the user
    > > needs to highlight the "Refine your Search" section to replace this with
    > > thier text.
    > >
    > > I've googled and found javascript (which doesn't seem to work with the
    > > server side control).
    > >
    > > Is there a way to do this with ASPNET??
    > >
    > > TIA
    > > Harry
    > >
    > >
    >
    >

    Harry Simpson Guest

  5. #4

    Default Re: Selecting all text in a textbox?

    You got it :) - Control.Attributes is kind of hard to find if you don't
    already know about it...

    "Harry Simpson" <hssimpson@nospamphgt.net> wrote in message
    news:%23or69CSVDHA.1816@TK2MSFTNGP09.phx.gbl...
    > Thanks Marc,
    >
    > I got it working:
    >
    > Added this to the codebehind load of screen:
    > txtSearchText.Attributes.Add("onfocus", "SetSelected();")
    >
    > Then add this to the html of the aspx page:
    >
    > function SetSelected()
    > {
    > document.Form1.txtSearchText.select();
    > }
    >
    > Thanks for the reply
    > Harry
    >
    > "Marc Hoeppner" <marchoeppner@hotmail.com> wrote in message
    > news:ey8Kd5RVDHA.2004@TK2MSFTNGP11.phx.gbl...
    > > Hi,
    > >
    > > you should be able to use JScript with ASP.NET just fine, in fact you
    need
    > > JScript to do what you want. What was the problem with the Jscript in
    > > combination with ASP.NET?
    > >
    > > Best regards,
    > >
    > > Marc Höppner
    > > NeoGeo
    > >
    > > "Harry Simpson" <hssimpson@nospamphgt.net> wrote in message
    > > news:OvHWwrRVDHA.3232@tk2msftngp13.phx.gbl...
    > > > I've got a server-side textbox that receives the focus when the page
    > > loads.
    > > > It has the text "Refine your Search" in the textbox. Obviously the
    user
    > > > needs to highlight the "Refine your Search" section to replace this
    with
    > > > thier text.
    > > >
    > > > I've googled and found javascript (which doesn't seem to work with the
    > > > server side control).
    > > >
    > > > Is there a way to do this with ASPNET??
    > > >
    > > > TIA
    > > > Harry
    > > >
    > > >
    > >
    > >
    >
    >

    Marc Hoeppner Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139