I have a web form with an optional date field.
1) I want a SQL datetime field retrieved into a mmTextBox displayed in a short format.
Setting the mmTextBox.DisplayFormat property to "d" for short date results in the field value contaning: "d".
What expression idiom do I use to set mmTextBox.DisplayFormat?
2) Also, a "String was not recognized as a valid DateTime." warning gets fired when the value is left blank. Is there an easy way to override this, or do I need to create a custom business rule?
[would be nice to be just set an "Optional" or "BlankOK" property in a WebUI control]
Tried using a custom business rule, but that didn't work.
public string ValidateHired(string hired)
{
string message = null;
if (hired == "")
{
this.ClearWarning("String was not recognized as a valid DateTime.");
}
return message;
}
Thanks!