Pages

Ads 468x60px

For New Update Use this Link http://dotnethubs.blogspot.in/ Offer for you

.

Showing posts with label asp.net - C#. Show all posts
Showing posts with label asp.net - C#. Show all posts

Tuesday 23 July 2013

How to allow only Numeric values into a textbox

How to allow only Numeric values into a textbox
Introduction :-

In my previous article i have explained how i can use validation control in asp.net.In this article I am explain how i can allow online integer values for text box using regular expression in asp.net.

Description : -
In my Previous article i have explained how to validated form using jquery in asp.net.And i have Provided Full Description with example for  each and every  control in asp.net. Name of Controls are

RequiredFieldValidation,RangeValidator,RegularExpressionValidator,CompareValidator,CustomValidator,
CustomValidator

In this article i have explain how to validate textbox using regular expression allow only integer values

Process :-
1 : - Create a new project in asp.net and add new from and drag and drop a text box and provide the id to the textbox.In this article the id of text box is txt_priority  .
2 : - Drag and drop the Regular Expression validator on the form and set the property as show below
ID =RegularExpressionValidator1
ControtoValidate= txt_priority   [this is textbox id]
ErrorMessage=Please enter numbers only
ForColor=Red
ValidationExpression=\d+

complete example as show below


<asp:RegularExpressionValidator id="RegularExpressionValidator1"
                   ControlToValidate="txt_priority"
                   ValidationExpression="\d+"
                   Display="Static"
                   EnableClientScript="true"
                   ErrorMessage="Please enter numbers only"
                   runat="server" ForeColor="Red"/>


 

..




New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result