We have been developing a whole new information system in ASP.NET (using VB not C#) which has highlighted quite a few interesting questions, which after much searching we have found answers to. My idea is to put the answers here on my blog, one after the other so that other developers who are learning ASP.NET might not fall into the same traps and problems that we have faced!
If you try to set the value of a textbox to a recordset item:
e.g. Me.txtWhatever.Text = dr("FieldName")
if the field in the Data Row (dr) is null you will get an error. The resolution is to encapsulate the statement with a check to see if the item is null first:
if NOT IsDBNull(dr("FieldName")) then
Me.txtWhatever.Text = dr("FieldName")
the "IsDBNull" is a built-in ASP.NET function for checking if field items are null.
I will be adding more ASP.NET tips as I can (when I get time!)