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

column validation does not work for string (required) and for email

I have written a "toy" application to become familiar with syncfusion.  I am working with grid for mvc.  Things were going well (other than dropdown box not working for me) but now I cannot get column validation to work.  I have the 2 js files in my layout view and believe the razor code follows your examples.  I have attached the entire solution.  The view in question is home.Index and the controller is Home.  Please let me know if there is any information I can provide .
Thank your for your attention to this.

Attachment: FirstGrid_a026c166.zip

5 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team February 9, 2017 01:10 PM UTC

Hi Lawrence,  
 
Thanks for contacting Syncfusion Support. 
 
Query #1: dropdown box not working for me 
 
There is no “gender” field existing in your dataSource. So the values were not bound to the respective column as well as the editing DropDown. So we have changed the Grid columns as follows. 
 
       @(Html.EJ().Grid<Object>("FlatGrid") 
                       .Datasource((System.Data.DataTable)ViewBag.dataSource) 
             .EditSettings(edit => 
             { 
                 edit.AllowAdding().AllowDeleting().AllowEditing(); 
             }) 
             .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("No").HeaderText("ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Add(); 
             . . .  
              . . . . 
            col.Field("PersonGender").EditType(EditingType.Dropdown).Add(); 
            col.Field("DOB").EditType(EditingType.Datepicker).Add(); 
            col.Field("Active").EditType(EditingType.Boolean).Add(); 
        })) 
     
 
 
You can also assign the dataSource of the Grid columns which in turn can be assigned as a dataSource for the EditingType DropDown. But this dataSource must the text/value pair as shown in the following code example. 
 
        @(Html.EJ().Grid<Object>("FlatGrid") 
              . . . 
                    . . 
 
        .Columns(col => 
        { 
            . . . 
            col.Field("PersonGender").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.dropData).Add(); 
                 . . .  
        })) 
         
 
        public ActionResult Index() 
        { 
            . . .  
                   . . . 
            List<object> dropData = new List<object>(); 
            dropData.Add(new { text = "1", value = 1 }); 
            dropData.Add(new { text = "2", value = 2 }); 
            ViewBag.dropData = dropData; 
            return View(); 
        } 
 
Refer to the following Help Documents.  
 
 
 
Query #2: I cannot get column validation to work 
 
We are able to reproduce the problem at our end. You have referred the jquery.validate.min.js scripts but the given path is wrong. So the validation is not worked in your application. Refer to the following Help Documents. 
 
 
We have modified the sample that can be downloaded from the following location. 
 
 
Regards, 
Seeni Sakthi Kumar S. 



LG lawrence greenberg February 9, 2017 03:09 PM UTC

Hi Seeni,
Thank you for your prompt response.  I am amazed how fast your useful response was and appreciate your going an extra step in indicating how to populate the dropdown box even though I didn't request it.  I am looking forward to continue using Syncfusion's large set of tools with the knowledge that there is excellent support to back me up.

An additional question - is there a visual studio tool to validate my syncfusion code?
best regards,
Lawrence Greenberg


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team February 10, 2017 11:30 AM UTC

Hi Lawrence,  
 
We suspect that you are looking for IntelliSense feature of the Visual Studio over the Syncfusion Controls. For the General Query over IntelliSense, please refer to the following article.  
 
 
Likewise, while using Syncfusion Controls in the MVC projects, you can get the filtered APIs and other sub-properties in the key strokes as shown in the following screenshot. 
 
 
 
If we misunderstood your query, please get back to us with specific details on the Visual Studio tools, which would be helpful to analyze your requirement and provide you solution as early as possible. 
 
Regards, 
Seeni Sakthi Kumar S. 



LG lawrence greenberg February 10, 2017 03:43 PM UTC

Seeni,
What I was thinking of was the error that I had where my reference to a script file had the wrong path.  But that is something that should be picked up at build time by the compiler and is outside your domain.  Another feature that would be nice to have would be checking the values of literals but I suspect this is too difficult.
Please ignore my suggestion for an error detection tool


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team February 13, 2017 12:11 PM UTC

Hi Lawrence,  
 
Thanks for the update. Please get back to us, if you require further assistance on this. 
 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon