Interviews3 answers
how we take only numeric value in a text box.
3 Answers
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.
nitesh kumarPosted Jul 31, 2008, 11:23 PM EDT
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
prakash kumarPosted Jul 25, 2008, 2:13 AM EDT
You have to use Regular Expression Validator provide by dot net.
ex: ^[0-9]$
seemant srivastavaPosted Jul 24, 2008, 7:08 AM EDT