Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 October 27th, 2011, 06:10 AM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default Validating data type

Hi Imar, regarding validating data input to the contact form is there any way to validate the data to see if it should be numeric only or letters only.

Regards
Mark
 
Old October 29th, 2011, 09:39 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look at the CompareValidator and its Type property in particular.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
markhh (October 31st, 2011)
 
Old October 31st, 2011, 03:16 PM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Hi Imar and thanks for your helpful reply,

Regards
Mark
 
Old July 9th, 2012, 03:24 AM
AnnieCalvert
Guest
 
Posts: n/a
Default

If the view model fields have validation data annotations on them, you will still get validation errors when navigating to the next step.Create a custom attribute, ValidateIncomingValuesOnlyAttribute, that inherits from ActionFilterAttribute, and apply it to your controller class.Override the On Action Executing method.
http://www.dapfor.com/en/net-suite/n...ial/data-types
Received Infraction





Similar Threads
Thread Thread Starter Forum Replies Last Post
he conversion of a char data type to a datetime data type resulted in an out-of-range adamhw Classic ASP Basics 3 December 23rd, 2009 07:18 AM
Chapter 8: Validating the Format of Data rubyjews BOOK: Beginning Ruby on Rails 2 March 15th, 2007 08:26 PM
Validating submitted data leno Beginning PHP 6 January 5th, 2005 06:18 AM
Data Type error but it is the correct type Mitch SQL Server 2000 2 March 19th, 2004 11:31 AM





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