0

我有以下代码:

<asp:TableCell>
    <asp:Label Text="Date of Birth:" Runat="server" cssClass="EditLabel" ID="Label3"/>                                              
</asp:TableCell>
<asp:TableCell>
    <asp:Textbox id="txtDOB" Runat="server" EnableViewState="True"/>
    <asp:CustomValidator ControlToValidate="txtDOB" ErrorMessage="Date of Birth is not Valid" Runat="server" OnServerValidate="CheckDOB">*</asp:CustomValidator>                        
</asp:TableCell>
<asp:TableCell>

函数定义为:

Protected Sub CheckDOB(ByVal source As Object, ByVal args As ServerValidateEventArgs)

  ....

End Sub

当我提交代码时,函数永远不会被击中。这里缺少什么?

4

1 回答 1

1

尝试重新定义处理程序。从OnServerValidate="CheckDOB"自定义 ASPX 验证器标记中删除并在 VB 中定义处理程序,如下所示:

Protected Sub CheckDOB(ByVal source As Object, ByVal args As ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

End Sub
于 2013-07-23T16:02:34.457 回答