This topic is locked

Date field default value

11/17/2005 4:23:03 PM
ASPRunner.NET General questions
author

Date fields on the edit page can default to specific dates, but can they be null values?
I need to let users edit records without modifying all the otherwise blank date fields.

500387 11/18/2005

At the page *edit.aspx.cs you can add the following code for the date fields:

(c# version)

if (dr["SomeDateField"] == System.DBNull.Value ) fldSomeDateField.Enabled = false;

else

{

... old generated code ...

}



(vb.net version)

If dr["SomeDateField"] = System.DBNull.Value Then

fldSomeDateField.Enabled = False;

Else

... old generated code ...

End If
500388 11/18/2005

Thanks for the reply. I'm using vb, so I think .cs file is the wrong one to edit. Any chance you could elaborate on the fix? The date fields need to show blank values, and allow, but not require the user to fill them out when editing a record.