Customvalidator not working using Validationgroup

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pompeymike
    New Member
    • Sep 2007
    • 1

    Customvalidator not working using Validationgroup

    Hi, I have a form with panels, within which is a Formview. In the InsertItemTempl ate for the FormView I have validation using RequireFieldVal idators. These all work correctly, but if I use a CustomValidator it totally ignores it. I have debugged the app and it quite happily goes through the code behind, setting eArgs.IsValid = False , but no error message - it just goes off and inserts the data, using the SqlDataSource.

    Has anyone any clues?

    Code is........


    Code:
    <td style="text-align: right; height: 30px; width: 368px;">TESTER :</td>
    
    <td style="width: 325px; height: 29px">
    
    <asp:TextBox Runat="server" ID="tbxTESTER" Height="24px" Width="300px" />
    
    <asp:CustomValidator ID="cvTESTER" runat="server" EnableViewState="False" ErrorMessage="TESTER Message" OnServerValidate="TESTER" ValidationGroup="ValidEnterReceiverGroup" SetFocusOnError="True" ControlToValidate="tbxTESTER" > </asp:CustomValidator></td>
    
    Public Sub TESTER(ByVal sender As System.Object, ByVal eArgs As ServerValidateEventArgs) 
    Dim TESTER As TextBox = CType(EnterReceiverFormView.FindControl("tbxTESTER"), TextBox)
    
    If TESTER.Text = "TESTER" Then
         eArgs.IsValid = False
    Else
         eArgs.IsValid = True
    End If
    End Sub
Working...