+1-888-365-2779
Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / Edit Field validation

Edit Field validation

4 posts, 0 answered
  1. Jason Grovert
    Jason Grovert avatar
    28 posts
    Registered:
    25 Oct 2005
    21 Mar 2007
    Link to this post
    Is there a way to make a User Control field required?  We need the ability to make certain fields required when editing.
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    22 Mar 2007
    Link to this post
    Hello Jason,

    Currently, such functionality is not implemented and intended.
    Thank you for your suggestion, we added it to our TODO list and hopefully we will implement it for the official release.

    Actually, you can set a DefaultValue attribute to ensure that the required field will have a value.

    Best wishes,
    Vlad
    the telerik team
  3. Jason Grovert
    Jason Grovert avatar
    28 posts
    Registered:
    25 Oct 2005
    23 Mar 2007
    Link to this post
    Setting the DefaultValue attribute has no affect on the initialized value of the Property.  For example, I created a boolean Property on one of my User Controls and did not initialize the private field value and gave set the DefaultValue attribute to true, but when I edit the control the value of the private field is false.

    How are we to enforce required fields within our User Controls without any such mechanism to support it?  Our only recourse at this point is to give our private fields an initial value and add logic to prevent the User from trying to set the field to an empty or null value.  This does not make for a very friendly user experience because it provides no feedback to the user as to why they cannot clear the field or why their change did not take affect.
  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    23 Mar 2007
    Link to this post
    Sorry Jason,

    I was wrong about the DefauttValue attribute, it does not set the default value of the property, it is used only to inform you that the default value is the value that the property is initialized with. So the only way is to set the initial value of the field in the code of the control.


    Regards,
    Vlad
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
Register for webinar
4 posts, 0 answered