Results 1 to 5 of 5

Thread: Text box Range Validation

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    66

    Smile Text box Range Validation

    In ASP.Net textbox, How i can restrict the user to enter maxlength. I should show message in label or message box, if user exceeding the maximum length.
    I am using C# as code behind.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Text box Range Validation

    Try using asp:RegularExpressionValidator and some reger code to to satisfy your needs (http://regexlib.com)
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    66

    Re: Text box Range Validation

    I had asked about maxlength validation.. not for regular expression..!! thanks for response..

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Text box Range Validation

    Quote Originally Posted by rnjnagu View Post
    I had asked about maxlength validation.. not for regular expression..!!
    Before jumping into the conclusion, have you even explored the feasibility of using RegularExpressionValidator to fulfill your requirement!!

    Takeout some time to read This article....
    __________________
    Rate the posts that helped you

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Text box Range Validation

    Hello,

    Obviously, there is the MaxLength property of the TextBox which would stop the user from entering any more details:

    http://msdn.microsoft.com/en-us/libr...maxlength.aspx

    But you don't get any feedback as to what is going on. To get that, you could use something like jQuery to do this. Here are some examples:

    http://docs.jquery.com/Plugins/Valid...hods/maxlength

    http://keith-wood.name/maxlength.html

    Hope that helps!

    Gary

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width