I have a few fields in a webforms and currently I’m not implementing any form of validation but I intend to do so.
Suppose I have the following UpdateParameters in my SQLDataSource:
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Date" Type="DateTime" />
<asp:Parameter Name="active" Type="Boolean" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
And a textbox for each of the fields. I tried, but couldn’t find a built-in way to validate the TextBoxes against the parameter type, so for example, the Date_TextBox would validate that the input is in a DateTime format. I know I can do custom validators with regexes and whatnot, but I feel there’s a built-in, simple way of doing it. Any ideas?
Have you tried using the
CompareValidator??You can specify the type like this:
The available types are: