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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Force dropdown validation on load

Thread ID:





127583 Nov 25,2016 06:49 AM UTC Nov 28,2016 11:52 AM UTC ASP.NET MVC 1
Tags: DropDownList
Juan Acosta
Asked On November 25, 2016 06:49 AM UTC


I have a dropdownlist that loads dynamically with the values of the ViewBag. The values are loaded fine. However, I added some custom validation to the dropdownlist that should be active as soon as it is load inside the control.

I have this kind of declaration.

<div class="form-group">
<label for="AreaName">Area:</label>
<div style="text-align:left;">
@Html.EJ().DropDownList("areasListMaintenance").Datasource((IEnumerable<DocTracerPortal.Models.Visual.VisualArea>)ViewBag.areasSourceMaintenance).DropDownListFields(f => f.Value("value").Text("text")).Enabled(true).EnableRTL(true).Width("70%").WatermarkText("Select an Area").ValidationRules(r => r.AddRule("required", true)).ValidationMessage(m => m.AddMessage("required", "Area required "))
<div class="form-group">
<label for="DocumentStatusName">Status:</label>
<div style="text-align:left;">
@Html.EJ().DropDownList("documentStatusListMaintenance").Datasource((IEnumerable<DocTracerPortal.Models.Visual.VisualDocumentStatus>)ViewBag.dsSourceMaintenance).DropDownListFields(f => f.Value("value").Text("text")).Enabled(true).EnableRTL(true).Width("70%").WatermarkText("Select a Status").ValidationRules(r => r.AddRule("required", true)).ValidationMessage(m => m.AddMessage("required", "DocumentCategory required "))
<div class="form-group">
<label for="DocumentCategoryName">Category:</label>
<div style="text-align:left;">
@Html.EJ().DropDownList("documentCategoriesListMaintenance").Datasource((IEnumerable<DocTracerPortal.Models.Visual.VisualDocumentCategory>)ViewBag.dcSourceMaintenance).DropDownListFields(f => f.Value("value").Text("text")).Enabled(true).EnableRTL(true).Width("70%").WatermarkText("Select a Category").ValidationRules(r => r.AddRule("required", true)).ValidationMessage(m => m.AddMessage("required", "Document Status required "))

The page load fine and I don't have any errors in the js console.

Nothing is selected, it should show the required message?

However, the control should active the required fields on load. Unfortunately, that does not seem to work.

I was checking other links in the forums and no one knows how to make it work.


I added the default validation and nothing happens too.

Could you please help me with this. I do not want to make a full page load of the entire page be able to show the required messages.

Kind regards,

Juan Acosta

Prince Oliver [Syncfusion]
Replied On November 28, 2016 11:52 AM UTC

Hi Juan,   
Thanks for contacting Syncfusion support.   
We have analyzed your code. Dropdownlist control stores a value in hidden input and in jQuery validation hidden input are ignored from validating by default. So, we need to set jQuery validation to include hidden input validation in order to validate dropdownlist. Please refer the following code snippet.   
        ignore: [],// To include hidden input validation.   
        errorClass: 'e-validation-error'// to get the error message on jquery validation   
        errorPlacement: function (error, element) {   
We have used your code and prepared a sample, refer to the following link for a sample:   
Refer to the following UG Documentation for more information:   
Let us know if you require any further assistance.   


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon