aditya kumar
how we take only numeric value in a text box.
By aditya kumar in ASP.NET on Jul 24 2008
  • nitesh kumar
    Aug, 2008 1

    First of all,u take one TextBox1 control then used to FilterTextboxExtender under AjaxControl.Now go to properties of FilterTextboxExtender n choose the TargetID properties and write the Textbox1 Id(Bydefault ID will be Textbox1)there. Now go to TextBox1 Properties there will be auto create the FilterTextbox Property there willbe one option ValidChars.So here u will put this following 0123456789 characters there.

    • 0
  • prakash kumar
    Jul, 2008 25

    Hai Aditya! There is a method isNumeric(object as expression).By using this method you can get only numbers in the text box. The Sample Code: In Visual Basic: =========================================================== Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Not IsNumeric(TextBox1.Text) Then MsgBox("Enter only the numbers:") End If End Sub ========================================================== I think this is very helpful to you ! Try and Reply

    • 0
  • seemant srivastava
    Jul, 2008 24

    You have to use Regular Expression Validator provide by dot net. ex: ^[0-9]$

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS