Common Function Library – HasValue()

Like many programmers, I have a Common Function Library containing generic methods I use over and over again. Here is one of them. I use this often to test if a variable or object exists and if it has any value. This is an easy way to avoid NullReferenceExceptions or other errors that would crop … Continue reading Common Function Library – HasValue()

How To Avoid Null Reference Exceptions in an ASPX File When Dynamically Populating a GridView or ListView Control

The situation: You have a GridView control with a TemplateField in your ASPX page that is dynamically populated from a database. You of course use an Eval() statement to dynamically populate the TemplateField, but the db field is nullable (and in fact contains a null value), and when you run the page, you get an … Continue reading How To Avoid Null Reference Exceptions in an ASPX File When Dynamically Populating a GridView or ListView Control