I have created a web user control to enter a date in three textboxes: txtDay, txtMonth and txtYear.
I have added a custom validator with server side code and client side javascript code. Both on the server and on the client the input will be validated to be a valid date. This works fine.

I have added a property ValidateEmptyText to my user control because I want to be able to set this property to true or false on the page where I use the date control. On some pages the date is required and on some pages it isn't.

I can check in my client side javascipt function if all three textboxes are filled and if not I can set args.IsValid to false. But the problem is, I only want to do this if the Property ValidateEmptyText of my Web User Control is True. If it's false then I want to set args.IsValid to True if all three textboxes are empty.

How can I do this? How can I read the value of the Property ValidateEmptyText of my web User Control from my javascipt function. Or is there another way to get to this?


<script type="text/javascript">
function check() {
if (document.getElementById('<%= txtbussname.ClientID %>').value == "") {
document.getElementById('<%= txtbussname.ClientID %>').focus();
return false;
else if (document.getElementById('<%= txtbussadd.ClientID %>').value == "") {
document.getElementById('<%= txtbussadd.ClientID %>').focus();
return false;

\Just provide the textid if the text is empty it will focus there if u want display the error take label and display in it...( document.getElementById('<%= lblerror.ClientID%>').innerHTML = "";)