You must Sign In to post a response.
  • Category: ASP.NET

    Validation in asp.net

    hi i want to validate tht user should not be able to enter any other character except digits using asp.net validators..how to do this
  • #344260
    Hi...Juhee
    it is very simple

    use below code for validating only digits
    eg: for ceill number..it allows only 10 digits

    [0-9]{10}

    0-9 means it will take only 0 to 9 digits like 0 1 2 3. ...9
    {10} means it will allows exactly 10 digits.it will not take les than 10 and grater tahn 10..

    dont forget to give rating...


    Thanks & Regards!
    Syed Shakeer Hussain

  • #344261
    Hi


    U can use the below code for validating the numeric values

    U have to replace the controltovalidate in the below code.


    <asp:RegularExpressionValidator Display="Dynamic" ID="regExpPhoneNumber" runat="server" ControlToValidate ="txtphoneNumber" ValidationExpression="^[0-9]*$" ></asp:RegularExpressionValidator>




    Thanks
    A S

    If u need any clarifications pls mail me.

    Thanks and Regards,
    A S.




    Note - Don't forget to rate this response [Poor / Fine / Good / Great / Excellent]


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.