在我的页面中,我有中继器,我使用它动态生成两个文本框,并且我有一个比较验证器。
现在对于这个验证器,我想设置 ControlTovalidate 和 ControlToCompare。两者的 ID 都来自两个动态生成的文本框。
因此,在将这些文本框绑定到中继器时,我设置了验证器的两个属性,但错误来自“'passwordCompare' 的 ControlToValidate 属性不能为空。”
<asp:repeater id="repeater" runat="server" onitemdatabound="BoundProperty">
<itemtemplate>
<asp:panel id="panelProperty" runat="server" cssclass="prop">
<asp:textbox id="textboxOrg" runat="server" cssclass="edit" visible="false"/>
</asp:panel>
</itemtemplate>
</asp:repeater>
<asp:comparevalidator id="passwordCompare" runat="server" controltovalidate="" controltocompare="" errormessage="CompareValidator"></asp:comparevalidator>