Edit this page


You can use the built in ASP.NET validation with RadListBox.

Validating RadListBox with RequiredFieldValidator

To validate for selected item of a listbox, just specify the ID of the listbox in the ControlToValidate property of the RequiredFieldValidator. Validation checks to see if there is at least one selected item.

<telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1"> 
    <telerik:RadListBoxItem Text="Apartments" />  
    <telerik:RadListBoxItem Text="Campings" />  
    <telerik:RadListBoxItem Text="Hotels" />  
    <telerik:RadListBoxItem Text="Hostels" />  
    <telerik:RadListBoxItem Text="Rooms" />  
    <telerik:RadListBoxItem Text="Villas" />

<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ErrorMessage="Please, select item!" ControlToValidate="RadListBox1" />              

If no item is selected, the validator fails and displays the error message:

RadListBox validation

See Also

Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article