We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom Validation attribute not working on Date Picker


We have custom validation attribute RequiredIf decorated on date property of model. but generated html is not adding required attribute to the tag as shown below
Class Property

       [RequiredIf("chkM", 1, "Date is Required")]
        public DateTime? MDate { get; set; }

<ejs-datepicker id="MDate" format="dd/MM/yyyy" ejs-for="MDate" placeholder="Choose a Date" enabled="true"></ejs-datepicker>

it is generating following html

<input onchange="datecheck()" id="MDate" data-val="true" name="MDate" ejs-for="true" class="e-control e-datepicker e-lib e-input e-keyboard" placeholder="Choose a Date" aria-placeholder="Choose a Date" aria-live="assertive" aria-atomic="true" aria-haspopup="true" aria-activedescendant="null" aria-owns="MDate_options" aria-expanded="false" role="combobox" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" aria-invalid="false" aria-disabled="false" tabindex="0" value="">

I am expecting following attribute also in tag

<input type="text" data-val="true" data-val-requiredif=" Date is Required" data-val-requiredif-dependentproperty="chkM" data-val-requiredif-targetvalue="1" id="MDate" name="MDate" value="">

1 Reply

BS Banupriya Selvaraj Syncfusion Team February 5, 2020 09:41 AM UTC

Hi Muhammad, 

Thanks for contacting Syncfusion support. 

We are sorry for the delay update. 

We have validated this reported query and created a feature report for “Custom validation support for ASP.NET Core”. It will be included in our Volume 1 release which is expected to be rolled out end of March.  

You can track the current status of your request through this link.   

We will update you once it released and we appreciate your patience until then. 


Live Chat Icon For mobile
Up arrow icon