Dropdown validation on ejs grid is not working.

I am trying to have a validation message for my Dropdown AccountTypeId but no luck. Any help will be appreciated. Thanks.
Index.cshtml
AddPartial:
Controller:


Model:

On Running:


5 Replies 1 reply marked as answer

VS Vignesh Sivagnanam Syncfusion Team June 8, 2021 08:40 AM UTC

Hi Joseph 
  
Greetings from Syncfusion support 
  
Based on your query you want to add a validation to the dropdown in the dialogTemplate in the grid. You can add a validation rules to the dropdown in the grid edit dialog using the EJ2 Grid actionComplete event. You can use the below Code example to achieve your requirement.  
  
Please refer the below Code example for your reference, 
  
function actionComplete(args) { 
      if (args.requestType === 'beginEdit' || args.requestType === 'add') { 
        (args.form).ej2_instances[0].addRules("OrderID", { required: [true, "Please enter a value"] }); 
        (args.form).ej2_instances[0].addRules("ShipCity", { required: [true, "Please select a value"] }); 
……………………………………………………………………………………. 
     } 
} 
 
  
  
Regards 
Vignesh Sivagnanam 



JO Joseph June 12, 2021 10:32 PM UTC

Hi Vignesh,

I still missing something because the validation is still not working.



AddPartial




It is weird because the validation triggers only when there is a cascading.






VS Vignesh Sivagnanam Syncfusion Team June 15, 2021 02:36 PM UTC

Hi Joseph 
  
Sorry for the late reply 
  
Based on your query we found that you have faced issue with the validation rules in the grid’s dialog template. We checked your code example and we have prepared a sample by append the validation rules to the dropdown, but we are still not able to reproduce the reported issue at our end. 
  
Please share the below details to validate further, 
  
1. Modify the below sample with your code and share to us to validate. 
  
2. Share the issue reproduced sample. 
  
3. Share full grid code example. 
  
  
Regards 
Vignesh Sivagnanam 


Marked as answer

JO Joseph replied to Vignesh Sivagnanam June 19, 2021 06:52 PM UTC

Hi Vignesh!  Thank you so much! It works now!!! Cheers! Keep safe!!



VS Vignesh Sivagnanam Syncfusion Team June 21, 2021 12:14 PM UTC

Hi Joseph 

We are happy to hear that your issue has been resolved. 

Please get back to us if you need further assistance. 

Regards, 
Vignesh Sivagnanam 


Loader.
Up arrow icon