How to change "The Id field is required" in DropDownList?

1 Answer 40 Views
DropDownList Grid
Janko
Top achievements
Rank 1
Iron
Iron
Janko asked on 02 Oct 2023, 11:35 AM

I'm using DropDownList in grid as EditorTemplate. If no value is selected I get a message that says "The Id field is required". How to change the message or remove it completely?

1 Answer, 1 is accepted

Sort by
1
Accepted
Vasko
Telerik team
answered on 02 Oct 2023, 01:56 PM

Hi Janko,

Depending what you want - to remove or to change the message - here are the 2 approaches:

  • To change it, in your Model, adjust the Required modifier above the properties you want to display a custom message to (see screenshot for end result):  
        public class Calls
        {
            [Required(ErrorMessage="This is a custom validation message")]
            public string? Name { get; set; }
        }
  • To remove it completely, remove the Required modifiers above the properties (see gif): 
        public class Calls
        {
            // [Required(ErrorMessage="This is a custom validation message")]
            public string? Name { get; set; }
        }

Kind regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
DropDownList Grid
Asked by
Janko
Top achievements
Rank 1
Iron
Iron
Answers by
Vasko
Telerik team
Share this question
or