Wrox Programmer Forums
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 March 20th, 2007, 01:23 AM
Registered User
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to handle null values

Hi All

i am using grid view to populate records, I am binding data using template fields by writing my own code using code-behind file.

some times it raises erros for null values.

plz tell me how can i handle null values while dealing with gridview control.

Old March 20th, 2007, 01:52 AM
Friend of Wrox
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts

This is a long term issue: How to handle "Nulls". My personal preference is I don't allow nulls in my tables or database, either I will not write the empty column or I will give it a default value. This eliminates the problems when you allow the user to enter a value, if the entered field is text field datatype, users will enter a space, a tab key (to go to the next field), etc. If the field is a numeric type field, users may skip or space the numeric field. Numeric fields I would either place a "0" or some number "99999" to indicate an empty cell. In addition to default values, it is a good practice to use "validation" on fields you allow to be NULLs.

Hope this helps.

Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Handle Null or Blank values using xslt in csv data mums XSLT 1 April 3rd, 2008 07:30 PM
How do I handle NULL resultset field? cm.cruz Classic ASP Basics 1 January 28th, 2008 06:29 PM
Dates and Null Values eliza ASP.NET 2.0 Basics 6 February 2nd, 2007 01:18 PM
Null values jmcgranahan BOOK: Access 2003 VBA Programmer's Reference 0 August 29th, 2006 02:25 PM
Handling Null Values ~Bean~ ASP.NET 1.x and 2.0 Application Design 1 January 31st, 2006 02:02 PM

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