Solved

Suppressing Null Fields

Posted on 2011-09-13
1
198 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

17 Experts available now in Live!

Get 1:1 Help Now