This is a migrated thread and some comments may be shown as answers.

DataEntry enum filter

2 Answers 100 Views
DataEntry
This is a migrated thread and some comments may be shown as answers.
Emin
Top achievements
Rank 1
Emin asked on 20 Jun 2019, 03:27 PM

Hello,

 

How can I filter enum from unwished values.

public enum StudentType
{
None,
Commercial,
Free,
Partial
}
 
public class Student
    {
        public Student()
        {
        }
 
        public StudentType StudentType { get; set; }   

 

///

}

 

I want to see in the DataEntry list only filtered values, ex. Commercial and Free.  

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Jun 2019, 10:28 AM
Hello Emin,

You can use the EditorInitialized event for this:
private void RadDataEntry1_EditorInitialized(object sender, EditorInitializedEventArgs e)
{
    if (e.Property.Name == "StudentType")
    {
        var editor = e.Editor as RadDropDownList;
        foreach (var item in editor.Items.ToList())
        {
            if (item.Text != "Free" && item.Text != "Commercial")
            {
                editor.Items.Remove(item);
            }
        }
    }
}

I hope this helps. Should you have any other questions, do not hesitate to ask.
 
Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Emin
Top achievements
Rank 1
answered on 24 Jun 2019, 12:05 PM
Good idea, thank you!
Tags
DataEntry
Asked by
Emin
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Emin
Top achievements
Rank 1
Share this question
or