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
>
@(Html.Kendo().Grid<
BHEBS.Areas.Budget.Models.ContractBudgetModel.ServiceDetailReallocation
>()
.Name("serviceDetailReallocationGrid")
.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" });
}).Width(230);
})
.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
>))
))
Thanks,
Veena