Wrox Programmer Forums
.NET 4 and Visual Studio 2010 General Discussions For discussing anything about .NET 4, WPF, WCF, the rest of the .NET 4 Framework, and Visual Studio 2010 that isn't about a specific Wrox book. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET 4 and Visual Studio 2010 General Discussions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 3rd, 2014, 12:19 PM
Registered User
Join Date: Jan 2014
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default I need help with validation code

I am creating an engineering application. I need code to validate that a numeric value has been entered in a TextBox. Else return Focus to that TextBox.
Can I create a custom Control that will accept ONLY a numeric value of Double type?
Old February 6th, 2014, 09:47 PM
Friend of Wrox
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts

you can use a compare validator to do data type checks as such
<asp:CompareValidator ID="cmpvDataType" runat="server" ControlToValidate="txtMyValue" ErrorMessage="Not a valid value" Text="*" Type="Double" Operator="DataTypeCheck" />

Similar Threads
Thread Thread Starter Forum Replies Last Post
State code validation vbboyd BOOK: Beginning ASP.NET 4.5 : in C# and VB 5 April 3rd, 2013 05:43 PM
Code validation Isabella C# 3 January 4th, 2012 06:01 PM
Adding validation code in excel donsls Excel VBA 1 November 1st, 2008 01:37 AM
running example code from Ch 3 - Form Validation cshu BOOK: Professional Ajax ISBN: 978-0-471-77778-6 0 November 4th, 2006 05:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.