Make sure textbox input is numeric in a gridview itemtemplate

Posted on 2007-10-15
Last Modified: 2012-06-27
What's a simple quick way to make sure textbox input is numeric in a gridview itemtemplate?
Question by:ksfok
    LVL 16

    Accepted Solution

    Do you want to ensure that users can only type numbers into your text box?
    Are you happy with AJAX? If so check out the FilteredTextBox control in the AjaxControlToolkit: -

    If you only need to make sure that the value submitted is a number checkout the asp:validation controls.

    Otherwise you could either search out another third party component or write your own Javascript
    LVL 26

    Expert Comment

    using regular expression validator .. add this code within the template column where you want to validate the textbox ..
          <asp:RegularExpressionValidator runat=server
                ErrorMessage="Enter numeric"
                ValidationExpression="^[0-9]$" />


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now