Search code examples
c#asp.netcalendarrequiredfieldvalidator

.net Calendar requiredFieldValidator


Is it possible to add a requiredFieldValidator to a calendar? For example I have a submit button and if it is clicked without selecting a date red text should come up saying please select date first.

I know one way is to simply check for selectedDate in c# code but can I create a requiredFieldValidator as for textboxes?

Thanks in advance.


Solution

  • I think No but you can add a requiredFieldValidator and associate it with a hidden TextBox (I mean CSS display:none) on the page and bind the TextBox Text property to the SelectedDate of the calender