how to limit input with textbox multiline?

Discussion in 'ASP .Net' started by Terry, Feb 16, 2007.

  1. Terry

    Terry Guest

    Hi,

    i want to limit input in this textbox up to 2O characters, but i can input a
    unlimited amount of characters. How to limit that?

    <asp:TextBox ID="txtStreet" runat="server" Width="200px" MaxLength="20"
    rows="2" TextMode="MultiLine"/>


    Thanks
    Terry
     
    Terry, Feb 16, 2007
    #1
    1. Advertising

  2. On Feb 16, 8:48 am, "Terry" <> wrote:
    > Hi,
    >
    > i want to limit input in this textbox up to 2O characters, but i can input a
    > unlimited amount of characters. How to limit that?


    You can't do it using standard properties, for example, there is the
    MaxLength property, which has no effect in a multi-line textbox.

    Possible workarounds:

    1. JavaScript
    2. Codebehind
    3. CustomValidator

    CustomValidator example
    http://www.aspexpress.com/tips.asp?action=show&id=89
     
    Alexey Smirnov, Feb 16, 2007
    #2
    1. Advertising

  3. Terry

    Terry Guest

    Thanks


    "Alexey Smirnov" <> schreef in bericht
    news:...
    > On Feb 16, 8:48 am, "Terry" <> wrote:
    >> Hi,
    >>
    >> i want to limit input in this textbox up to 2O characters, but i can
    >> input a
    >> unlimited amount of characters. How to limit that?

    >
    > You can't do it using standard properties, for example, there is the
    > MaxLength property, which has no effect in a multi-line textbox.
    >
    > Possible workarounds:
    >
    > 1. JavaScript
    > 2. Codebehind
    > 3. CustomValidator
    >
    > CustomValidator example
    > http://www.aspexpress.com/tips.asp?action=show&id=89
    >
     
    Terry, Feb 16, 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. cw
    Replies:
    1
    Views:
    625
    James J. Foster
    Jun 27, 2003
  2. TCB
    Replies:
    1
    Views:
    5,964
    Craig Deelsnyder
    Mar 29, 2006
  3. Replies:
    1
    Views:
    1,084
    Victor Bazarov
    Jun 28, 2005
  4. yezanxiong
    Replies:
    4
    Views:
    521
    James [MS-SDK]
    Mar 24, 2005
  5. dale zhang
    Replies:
    8
    Views:
    426
    Tintin
    Nov 30, 2004
Loading...

Share This Page