I have a field that is populated with an automatic date, this field is validated with customValidator so that the date is not empty, the problem when the field is validated with empty and I click on some control of the page that Postback, validation be lost It is possible for every page post to be validated by customValidator
The following is the code for the control:
<asp:Label ID="lblDtInventario" CssClass="FormatacaoTextos" Style="width: 85px; margin-top: 3px;" Text="Dt. Inventário:" runat="server" />
<asp:TextBox runat="server" ID="txtDtInventario" SkinID="CampoData" Style="float: left;"></asp:TextBox>
<asp:CustomValidator runat="server" ID="CustomValidator" ControlToValidate="txtDtInventario" ErrorMessage=" " Display="Dynamic" ClientValidationFunction="ValidarDataInventario" ValidateEmptyText="true" ValidationGroup="vgObrigarCampo"></asp:CustomValidator>
The following is the validator code:
function ValidarDataInventario(src,args) {
args.IsValid = document.getElementById("ctl00_ContentPlaceHolder1_txtDtInventario").value == "" ? false : true;
};