Wrox Programmer Forums
|
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 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 8th, 2010, 10:13 PM
Registered User
 
Join Date: Feb 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Validation before LoadObjectFromScreen()

Hi, Everyone

I tried the examples in Chapter 4, and added a text box called Phone number on my EditPage with the following business rules:
Phone number is required and must be digits.

So in the LoadObjectFromScreen method I added:
baseEo.PhoneNumber = Convert.ToInt32(txtPhoneNumber.Text);

But if there is blank in the text field, then there is a run time error on it "Input string was not in a correct format.". Should I add some validation or validation controls before that method, or there are some better solutions there

Cheers
Eagle
 
Old February 25th, 2010, 11:24 AM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

Hi Eagle,
Yes you should put a check in before this line of code to make sure that the phone number contains a number. You also might want to store the phone number as a string rather than a number just in case a user types in spaces or ( ) for area code.
Hope this helps,
Vince





Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation before LoadObjectFromScreen() luckyeagle BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 0 February 8th, 2010 10:11 PM
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 AM
validation abhishekdubey_997 ASP.NET 1.0 and 1.1 Basics 4 November 3rd, 2006 09:16 AM
Validation NiNe ASP.NET 1.x and 2.0 Application Design 1 July 5th, 2005 10:27 AM





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