, пожалуйста, проверьте ниже фрагмент кода.
function EnableDisableValidator() {
var DropDownList1 = document.getElementById('DropDownList1');
var DropDownList2 = document.getElementById('DropDownList2');
var RequiredFieldValidator12 = document.getElementById('RequiredFieldValidator12');
if (DropDownList1.selectedIndex > 0 && DropDownList2.selectedIndex > 0) {
ValidatorEnable(document.getElementById('RequiredFieldValidator12'), true);
}
else {
ValidatorEnable(document.getElementById('RequiredFieldValidator12'), false);
}
}
..........
<asp:DropDownList ID="DropDownList1" runat="server" onchange="EnableDisableValidator();">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" onchange="EnableDisableValidator();">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
</asp:DropDownList>
<div style="display: none;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="TextBox1"
Enabled="false" ErrorMessage="*************" ></asp:RequiredFieldValidator>
Дайте мне знать, если какие-либо проблемы