I need to insert "null" into the database when a raddatepicker is empty. How is this accomplished? I use the following parameter for textboxes and it works just fine:
newDocCmd.Parameters.AddWithValue("@docReason", !string.IsNullOrEmpty(docReasonTextBox.Text) ? docReasonTextBox.Text : (object)DBNull.Value);
If I try the same for the raddatepicker I get the expected error of "cannot convert from 'object' to 'string'":
newDocCmd.Parameters.AddWithValue(
"@docSubDt"
, !
string
.IsNullOrEmpty(rdpSubDt.DbSelectedDate) ? rdpSubDt.DbSelectedDate : (
object
)DBNull.Value);