?
Solved

Suppressing Null Fields

Posted on 2011-09-13
1
Medium Priority
?
207 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:Carla Romere
1 Comment
 
LVL 2

Accepted Solution

by:
junkymail1 earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month16 days, 17 hours left to enroll

862 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