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

Validation is not working on grid dropdown column

@(Html.EJ().Grid<object>("FlatGrid")
    .Datasource(ds => ds.URL("api/List").BatchURL("api/Update").Adaptor(AdaptorType.UrlAdaptor))
    .AllowPaging()
    .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch).ShowConfirmDialog(); })
    .ToolbarSettings(toolbar =>
    {
        toolbar.ShowToolbar().ToolbarItems(items =>
        {
            items.AddTool(ToolBarItems.Add);
            items.AddTool(ToolBarItems.Edit);
            items.AddTool(ToolBarItems.Delete);
            items.AddTool(ToolBarItems.Update);
            items.AddTool(ToolBarItems.Cancel);
        });
    })
    .Columns(col =>
    {
        col.Field("UserName").HeaderText("User Name").EditType(EditingType.String).Add();
        col.Field("UserEmail").HeaderText("User Email").EditType(EditingType.String).Add();
        col.Field("Role").HeaderText("Role").EditType(EditingType.Dropdown).ValidationRules(v => v.AddRule("required", true).AddRule("minlength", 3)).DataSource(ViewBag.ds).Add();
    }))


Role column still allows empty selection, even with validation. Datasource came from backend with list of string.
How can I solve this issue?

Thanks

3 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team August 29, 2017 05:02 PM UTC

Hi Than, 
  
Thanks for contacting Syncfusion Support. 
  
We have checked your query and prepared sample with dropdown column for the Grid. But we are unable to reproduce the issue “validation is not working for the Grid dropdown column”. Please make ensure that you have added the “jquery.validate.min.js” file in your script section. Please refer to the sample and screenshot:- 
 
 
  
Sample Link:-  http://www.syncfusion.com/downloads/support/directtrac/132355/SAMPLE~1-794059454.ZIP 
  
 We need some additional information to find the cause of the issue. Could you please share us the following details given below. 
  
1. Grid code example ( both in server side and client side).  
  
2. Share your Layout.cshtml page. Also share screenshot as like above.  
  
3. If possible, provide an issue reproducing sample or hosted link or replicate the issue in the provided sample.  
  
4.  Essential studio product version details. 
  
The provided information will help us to analyze and provide you the solution as early as possible.     
  
Regards, 

 
Farveen sulthana T





TH Than Htike Aung August 30, 2017 02:24 AM UTC

Thanks for reply Farveen sulthana T.

I found out that "jquery.validate.min.js" is not included in render list even though there is such file already existed in project list.

After I included that file in _Layout, it works fine and problem is solved.

FYI, I used Syncfusion project template to create project.

Best regards,

Aung




FS Farveen Sulthana Thameeztheen Basha Syncfusion Team August 30, 2017 04:12 PM UTC

Hi Aung, 
  
Thanks for your update. We are glad to know that your reported problem has been resolved.  
  
Please get back to us if you need any further assistance. 
  
Regards, 
  
Farveen Sulthana T 


Loader.
Up arrow icon