1

我有一个自定义验证控件,用于验证三个控件以检查它们是否被选中。我也ValidatorCalloutExtender用于自定义消息。它可以在验证单个控件时正常工作,但是当我使用自定义验证器时出现此错误

Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be    undefined.
Parameter name: id

这是我的代码。

 <table>
 <tr>
 <td>
  <ajx:ComboBox runat="server" ID="cmbPaymentType" DropDownStyle="DropDownList" CssClass="drop-down-list"
AutoCompleteMode="SuggestAppend">
<asp:ListItem Text="Cash only,No cheques" Value="0"></asp:ListItem>
<asp:ListItem Text="Cash/Cheques Only" Value="1"></asp:ListItem>
<asp:ListItem Text="Cash/Temporary credit" Value="2"></asp:ListItem>
<asp:ListItem Text="True Credit Only" Value="3"></asp:ListItem>
<asp:ListItem Text="Bill-To-Bill Credit Only" Value="4"></asp:ListItem>
</ajx:ComboBox>
</td>

</tr>
<tr>
<td>
 <asp:ListBox ID="lstBoxCustomerName" runat="server" CssClass="list-item-normal">
<asp:ListItem>ABCKJHKJ</asp:ListItem>
<asp:ListItem>ABCKJHKJ</asp:ListItem>
<asp:ListItem>ABCKJHKJ</asp:ListItem>
<asp:ListItem>ABCKJHKJ</asp:ListItem>
</asp:ListBox>
</td>
 </tr>
<tr>
<td>
 <ajx:ComboBox runat="server" ID="cmbGroupNumber" DropDownStyle="DropDownList" CssClass="drop-down-list"
AutoCompleteMode="SuggestAppend">
</ajx:ComboBox>

</td>
</tr>
<tr>
<td>
 <asp:CustomValidator ID="PromotionOptionValidator" runat="server" 
  ErrorMessage="Please select atleast one promotion option." 
  onservervalidate="PromotionOptionValidator_ServerValidate"      ControlToValidate="cmbPaymentType&lstBoxCustomerName&cmbGroupNumber"></asp:CustomValidator>
 <ajx:ValidatorCalloutExtender runat="server" ID="PromotionOptionAjxValidator"   TargetControlID="PromotionOptionValidator"
 PopupPosition="TopLeft">
</ajx:ValidatorCalloutExtender>
</td>
 </tr>
 </table>

这是背后的代码

 args.IsValid = true;

        if (cmbPaymentType.SelectedIndex == -1 && lstBoxCustomerName.SelectedIndex == -1 && cmbGroupNumber.SelectedIndex == -1)
        {

            args.IsValid = false;

        }

是否可以ValidatorCalloutExtender与 CustomValidator 一起使用。谢谢。

4

0 回答 0