Вопрос

I'm using Telerik Mvc RadGrid and I want to get row values from the grid

This is my grid

@( Html.Telerik().Grid<Orpac.Models.Pm_Web_VehGet_Result>()
                     .Name("grdTransactions").NoRecordsTemplate("No record to display")
                     .Localizable("")
                     .DataBinding(d => d.Ajax().Select("GridTransactionBinding", "Transaction"))
                     .HtmlAttributes("width: 100%;cellpadding:0;")
                     .Columns(columns =>
                     {
                         columns.Bound(e => e.VdvId).Width(90).Title((string)ViewData["CardNo"]);
                         columns.Bound(e => e.FdpDepNam).Width(60).Title((string)ViewData["Department"]);
                         columns.Bound(e => e.VehPlate).Width(70).Title((string)ViewData["Plate"]);
                         columns.Bound(e => e.VehName).Width(60).Title((string)ViewData["Name"]);
                         columns.Bound(e => e.VehSurname).Width(60).Title((string)ViewData["Surname"]);
                         columns.Bound(e => e.VehAmtLim).Width(70).Title((string)ViewData["CurrentAmount"]);
                         columns.Bound(null).Width(110).ClientTemplate("<input type='text' id='current' onchange='changesum()' class='txtLA' onkeypress='return isNumber(event)'/>").Title((string)ViewData["LoadAmount1"]);
                         columns.Bound(null).Width(60).ClientTemplate("<span id='total' class='txtTA'/>").Title((string)ViewData["TotalAmount"]);
                     })
                     .ClientEvents(events => events.OnRowDataBound("onRowDataBoundTrans"))
                     .Selectable()
                     .Sortable()
                     .Pageable()
                     .Groupable()
                     .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
                     .Footer(true)
                     .Scrollable(scrolling => scrolling.Height(300))
                     .Resizable(config =>
                     {
                         config.Columns(true);
                     })
                     .Reorderable(config =>
                     {
                         config.Columns(true);
                     })
                    .ColumnContextMenu()
                   )

Grid

In this grid I just want to get "CurrentAmount" value from row and "LoadAmount" value from textbox which is inside the row and sum of two value write the total value in "TotalAmount"

Also i can sum two values ("CurrentAmount" and "LoadAmount") on onrowdatabound function

But i want to sum this two value on Textbox textchanged which textbox in "LoadAmount" row

how can i get values of that textbox row ?

Do you have any expriences about this topic

Thanks

Saul

Это было полезно?

Решение

I ate my two days on this staff but also i solve this problem.

The Telerik MVC Grid has some ClientEvents . The OnSave is the answer of my question.

Because when you use OnSave you can reach that rows all data with this event. Here is the

blog http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-client-api-and-events.html#OnSave

And this is my example

function onsave(e) {
var values = e.values;
var dataItem = e.dataItem;
var cur = parseInt(values.LoadAmount);


var total = cur + dataItem.TotalAmount;
e.cell.nextSibling.innerText = total;
}

Take Care

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top