Solved

Suppressing Null Fields

Posted on 2011-09-13
1
196 Views
Last Modified: 2012-05-12
I have a formview only in view mode that displays when a record is selected in a gridview on a web page. There are a couple of fields that can be null. How can I not display the labels that contain those values if the field is null in the database?
0
Comment
Question by:Hers2keep
1 Comment
 
LVL 2

Accepted Solution

by:
junkymail1 earned 500 total points
ID: 36532355
I ran into this problem as well.  All I could figure out to do was to do a try on the data:

try
 {
Table.PROD2_DATE = (DateTime)dataRow[0]["PROD2_DATE"];
}
catch
{
Table.PROD2_DATE = Date.Now();
 }

My page would blow up if I didn't check if the values were null.  Hope it helps.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now