Hello there.

Here is my problem with this aspx page integrated with javascript function validator:
  1. I need show in the javascript alert the ErrorMessage "The field is required", when validations is enabled;
  2. The aspx page and my GridView is not updated after inserting interval DateStart and DateEnd, why?
  3. The aspx page and my GridView is not updated after inserting interval DateStart1 and DateEnd1, why?
  4. Can you help me?

If you have link for similar task, please give it me.
Can you explain any one or any sample code related this.

Your help would be very appreciated.
Thanks in advance for your time and hints.

Cheers.
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="button.aspx.cs" Inherits="SqlServer_button" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body onload="InitValidators()">
    <form id="form1" runat="server">
    <div>
        <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="true" runat="server"
            ShowSummary="false" />
        <asp:TextBox ID="DateStart" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="DateStart"
            ErrorMessage="RequiredFieldValidator" Display="None"></asp:RequiredFieldValidator>
        <asp:TextBox ID="DateEnd" runat="server"></asp:TextBox>
        <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Not valid date!"
            ControlToValidate="DateEnd" ControlToCompare="DateStart" Type="Date" Operator="GreaterThanEqual"
            CssClass="redb" SetFocusOnError="false"></asp:CompareValidator>
        <asp:ImageButton ID="Button1" ImageUrl="images/cerca_icon.gif" runat="server" OnClick="Button1_Click"
            OnClientClick="javascript:InitValidators();return false;" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="DateEnd"
            ErrorMessage="RequiredFieldValidator" Display="None"></asp:RequiredFieldValidator>
        <br />
        <br />
        <asp:TextBox ID="DateStart1" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="DateStart1"
            ErrorMessage="RequiredFieldValidator" Display="None"></asp:RequiredFieldValidator>
        <asp:TextBox ID="DateEnd1" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="DateEnd1"
            ErrorMessage="RequiredFieldValidator" Display="None"></asp:RequiredFieldValidator>
        <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Not valid date!"
            ControlToValidate="DateEnd1" ControlToCompare="DateStart1" Type="Date" Operator="GreaterThanEqual"
            CssClass="redb" SetFocusOnError="false"></asp:CompareValidator>
        <asp:ImageButton ID="Button2" ImageUrl="images/cerca_icon.gif" runat="server" OnClick="Button2_Click"
            OnClientClick="javascript:InitValidators();return false;" />
        <asp:Label ID="MessagesLabel" runat="server" Text=""></asp:Label>
        <br />
        <br />
    </div>
    </form>
    <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>
</body>
</html>