Posts

Showing posts from February, 2009

Un required validator pentru DropDownList cu RangeValidator

Validatorul RangeValidator va aparea in UI ca un RequiredValidator. Utilizatorul nu va putea trece mai departe daca nu alege o optiune de la 1 la 5. :)

<asp:DropDownList ID="ddlTitle" runat="server">
<asp:ListItem Value="0">Select Title</asp:ListItem>
<asp:ListItem Value="1">Mr</asp:ListItem>
<asp:ListItem Value="2">Mrs</asp:ListItem>
<asp:ListItem Value="3">Miss</asp:ListItem>
<asp:ListItem Value="4">Ms</asp:ListItem>
<asp:ListItem Value="5">Dr</asp:ListItem>
</asp:DropDownList>

<asp:RangeValidator ID="rangeValidator"
Text="*"
ErrorMessage="The title is required."
ControlToValidate="ddlTitle"
Type="Integer"
MinimumValue="1"
MaximumValue="5"
runat="server"
><…