View Single Post
  #9 (permalink)  
Old August 8th, 2012, 05:08 AM
cms9651 cms9651 is offline
Authorized User
Points: 121, Level: 2
Points: 121, Level: 2 Points: 121, Level: 2 Points: 121, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 27
Thanks: 6
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Code:
 
OnClientClick="javascript:InitValidators();return false;"
You're returning false, so your regular click casuing a postback never fires....

Imar
Ok, I tried this, but I have all ValidatorEnable true...
Code:
OnClientClick="javascript:InitValidators();"
This condition not working end of run:
Code:
    <script type="text/javascript" language="javascript">
        function InitValidators() {

            var DateStart = document.getElementById('<%=DateStart.ClientID%>');
            var DateEnd = document.getElementById('<%=DateEnd.ClientID%>')
            var DateStart1 = document.getElementById('<%=DateStart1.ClientID%>');
            var DateEnd1 = document.getElementById('<%=DateEnd1.ClientID%>')

            if (DateStart.value == '' || DateEnd.value == '') {
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator1.ClientID%>'), true);
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator2.ClientID%>'), true);
            }
            else {
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator1.ClientID%>'), false);
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator2.ClientID%>'), false);

            }

            if (DateStart1.value == '' || DateEnd1.value == '') {
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator3.ClientID%>'), true);
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator4.ClientID%>'), true);
            }
            else {
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator3.ClientID%>'), false);
                ValidatorEnable(document.getElementById('<%= RequiredFieldValidator4.ClientID%>'), false);
            }
        }
    </script>
Reply With Quote