Hi,
here iam facing problem with required field validator disappears for the textbox controls when user browse the file and clicks upload button using asp.net file upload control.
ee my below code
function setValidations() {
var selValue = document.getElementById("DDLID").value;
var reqVal = document.getElementById("RequiredFieldValidatorID");
var reqVal2 = document.getElementById("RequiredFieldValidatorID2");
if (selValue == "a") {
ValidatorEnable(reqVal, false);
ValidatorEnable(reqVal2, false);
}
else {
ValidatorEnable(reqVal, true);
ValidatorEnable(reqVal2, true);
}
}
</script>
<asp:DropDownList ID="DDLID" runat="server" onchange="setValidations()" ValidationGroup="abc">
<asp:ListItem Value="a">No
<asp:ListItem Value="b">Yes
<asp:TextBox ID="TextBox1" runat="server" >
<asp:RequiredFieldValidator ID="RequiredFieldValidatorID" runat="server"
ControlToValidate="TextBox1" ErrorMessage="*" ValidationGroup="abc" >
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button2" runat="server" Text="upoad" OnClick="btnUpload_Click" />
<asp:RequiredFieldValidator ID="RequiredFieldValidatorID2" runat="server" ValidationGroup="abc"
ControlToValidate="FileUpload1" ErrorMessage="*" >
<asp:Button ID="Button1" runat="server" Text="save" OnClick="btnUpload_Click"/>