Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating date field
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00811507
Message ID:
00811593
Views:
10
Neil,
Thank you so much for your help. I will try to apply your suggestion.

>Dmitry,
>
>I find the easiest way to validate a field in ASP.NET is to use a WebControl validator. For example, if you wanted to validate the date field is formatted correctly then you would use a text control associate a control based on the following class.
>
>protected System.Web.UI.WebControls.TextBox CompletionDate;
>protected System.Web.UI.WebControls.CompareValidator CompletionDateCompareValidator;
>
>The CompareValidator control supports the following properties:-
>
>Type=Date
>ErrorMessage=Date format is incorrect
>ControlToValidate=CompletionDate
>Operator=DateTypeCheck
>
>Once you need the value as a System.DateTime type then you can convert the contents as the value should be validated correctly.
>
>Convert.ToDateTime(CompletionDate.Text)
>
>I am by no means an ASP.NET expert but this seems to work for my limited requirements.
>
>Regards
>Neil
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform