Click here to Skip to main content
14,698,691 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using a text box and i want that whenever a user enter any value at runtime , the text box accept only integer value , please tell me the code for this problem
Sergey Alexandrovich Kryukov 16-Sep-11 20:33pm
Tag it? WPF, Silverlight, Forms, ASP.NET, what?

The easiest way is to use a BindingSource to an object with the properties you want to populate on the form, this way you get automatic data validation done.

public class formdata
   public int integerVal {get; set;}
   // other data
Mohd Saeed 16-Sep-11 20:54pm
you can achieve this in two ways

1. using javascript
2. using ajax

2.using ajax

<asp:TextBox ID="txtPincode" runat="server" class="txtfeild" MaxLength="6" />
                                                    <cc1:FilteredTextBoxExtender ID="txtPincode_FilteredTextBoxExtender" runat="server"

                                                        Enabled="True" TargetControlID="txtPincode" FilterMode="ValidChars" FilterType="Numbers">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900