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

Validation not firing when pressing save in batch mode

Thread ID:





118208 Feb 11,2015 11:47 AM UTC Feb 12,2015 01:21 PM UTC ASP.NET MVC 1
Tags: Grid
Paul Pitchford
Asked On February 11, 2015 11:47 AM UTC

@model IEnumerable<SyncfusionMvcApplication4.Models.Game>

@section scripts {
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>


        .Datasource(ds => ds.Json((IEnumerable<object>)Model).BatchURL("/Games/Update").Adaptor(AdaptorType.RemoteSaveAdaptor))
            .EditSettings(edit =>
        .ToolbarSettings(toolbar =>
            toolbar.ShowToolbar().ToolbarItems(items =>
        .Columns(col =>
            col.Field("GameDescription").HeaderText("Game").TextAlign(TextAlign.Left).Width(90).ValidationRules(v => v.AddRule("required", true)).Add();
            col.Field("GameDate").HeaderText("Date").Format("{0:dd/MM/yyyy HH:mm}").EditType(EditingType.DateTimePicker).TextAlign(TextAlign.Left).Width(90).ValidationRules(v => v.AddRule("required", true)).Add();
            col.Field("GameTypeId").HeaderText("Game Type").ForeignKeyField("Id").ForeignKeyValue("GameTypeName").DataSource((IEnumerable<object>)ViewBag.gameTypes).Width(75).ValidationRules(v => v.AddRule("required", true)).Add();

The above is code I am using for a grid which works just fine in batch mode.  However, if I add a new row and click save immediately validation does not fire and the empty model passes to my controller which obviously requires work in the background to handle the error. Ideally I'd like the validation methods to take care of this on the client side. Why wouldn't my validation rules be triggering here when save is pressed?

FYI, I have <add key="UnobtrusiveJavaScriptEnabled" value="false" /> in my web.config.

Madhu Sudhanan P [Syncfusion]
Replied On February 12, 2015 01:21 PM UTC

Hi Paul,

Thanks for using Syncfusion products.

Query: “Why wouldn't my validation rules be triggering here when save is pressed?”

We have analyzed the reported query and suspect that the validation is not triggered due to default values in the added row (For number-0, string- “” will be added by default). By default, the added row will contain default values for batch editing. And it is advisable to use batch add but we can provide the default value to column with the “DefaultValue” property of the columns.


. . . .

    .Columns(col =>


  col.Field("OrderID").HeaderText("Order ID").DefaultValue(100).IsPrimaryKey(true) Add();

            col.Field("CustomerID").HeaderText("Customer ID").DefaultValue("ASK").Width(80).Add();          


The above DefaultValue property can be used to provide the default values to the column while normal/dialog editing.

Please let us know if you have any queries or we misunderstood your requirement.


Madhu Sudhanan. P


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

or the page will be automatically redirected to 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