Hi to all!
I've got this problem, I'm thinking on it for about 2 days, searching info on the web ... but nothing.
Here's the problem: I've got a long FormView control that works fine. I added a lot of RequiredFieldValidator on a lot of fields and all works fine: when I click the FormView "InsertButton", the page reloads and I see that all the RequiredFieldValidator worked fine.
But I need to use also a lot of CustomValidator. I tried first the "client-side" style, using JavaScript functions and it worked ok. But my web-admin told me I can't use client-side validation: I can't use JavaScript due to accessibility issues.
Well, this is not a problem! I switched to server-side validation ... but it doesn't work at all! The server-side function is never called! Here's the code:
- Code: Select all
<asp:FormView ID="fv" runat="server" AllowPaging="True" DataKeyNames="id" DataSourceID="dsMain"
DefaultMode="Insert" Width="760px">
...
<InsertItemTemplate>
...
<asp:TextBox ID="s1a2altroTextBox" runat="server" Text='<%# Bind("s1a2altro") %>' Enabled="False" Width="400px" MaxLength="100"></asp:TextBox>
<asp:CustomValidator ID="s1a2altroCV" runat="server" ErrorMessage="CustomValidator" OnServerValidate="s1a2altroFV">Not ok</asp:CustomValidator>
...
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="GO!"></asp:LinkButton>
</InsertItemTemplate>
...
</FormView>
and here's the Sub:
- Code: Select all
Sub s1a2altroFV(ByVal sender As Object, ByVal args As ServerValidateEventArgs)
Dim t1 As TextBox
t1 = fv.FindControl("s1a2altroTextBox")
lblTest.Text = t1.Text
args.IsValid = False
End Sub
Please help me I need to finish this work for tomorrow!

(I hate this kind of work!) Thank you in advance.