• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1027
  • Last Modified:

Make sure textbox input is numeric in a gridview itemtemplate

What's a simple quick way to make sure textbox input is numeric in a gridview itemtemplate?
Thanks
0
ksfok
Asked:
ksfok
1 Solution
 
McExpCommented:
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: -

http://asp.net/AJAX/AjaxControlToolkit/Samples/FilteredTextBox/FilteredTextBox.aspx

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

Rejo
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now