Custom validation on telerik mvc inline grid save event

2 posts, 0 answers
  1. Veena
    Veena avatar
    14 posts
    Member since:
    Oct 2015

    Posted 31 Dec 2015 Link to this post

    I have a inline grid and 'sumBudgetAmount' value in a page. When user clicks edit and updates 'IncreaseByAmt' in the grid, I have to check the sum of all the records of 'IncreaseByAmt' in the grid and see it is not greater than 'sumBudgetAmount' value. I want to do client side validation on gridsave event.

    I can not do server side validation as I am not updating to the database when user clicks update button. It is a batch editing where user clicks save and then I am saving all the values to the database. So I can use only client side validation.


    <span id="sumBudgetAmt"> @(Model.SumBudgetAmount) </span>
                .Columns(columns =>
                    columns.Bound(p => p.ServiceDetailId).Hidden(true);             
                    columns.Bound(p => p.IncreaseByAmt).EditorTemplateName("Currency").Format("{0:c}");
                    columns.Command(command =>
                        command.Edit().HtmlAttributes(new { @class = "btn-primary" });
                .Events(e => e.Save("onServiceDetailReallocationGridSave"))                
                .DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Read(read => read.Action("ServiceDetailReallocation_Read", "ContractBudget"))
                .Model(model =>
                    model.Id(p => p.ServiceDetailId);
                .Update(update => update.Action("Update_ServiceDetailReallocation", "ContractBudget"))
                .Events(e => e.Error(@<text> function(args) {var gridName = 'serviceDetailReallocationGrid';errorGrid(args, gridName);  }  </text>))





  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2026 posts

    Posted 04 Jan 2016 Link to this post

    Hello Veena,


    My suggestion is to review the Grid / Custom validator editing demo that shows how to implement such behavior. 


    Please let us know if you need any further assistance. 


    Boyan Dimitrov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top