HI,
I need to traverse through radgrid dataitems on client to perform some logic. It looks like my code works fine in readonly and update mode, however it does not work when
I am trying to insert any item in the grid. Basically I do not know how to get reference to the "to be inserted item".
For example, if I am inserting first item in the grid then
masterTableView.get_dataItems().length returns 0.
So the Question is:
1. how do I reference the "To be inserted item"
2. how do I get a reference an element/control inside "To be inserted item")
Please Help...
Here is my javascript function:
I need to traverse through radgrid dataitems on client to perform some logic. It looks like my code works fine in readonly and update mode, however it does not work when
I am trying to insert any item in the grid. Basically I do not know how to get reference to the "to be inserted item".
For example, if I am inserting first item in the grid then
masterTableView.get_dataItems().length returns 0.
So the Question is:
1. how do I reference the "To be inserted item"
2. how do I get a reference an element/control inside "To be inserted item")
Please Help...
Here is my javascript function:
function
getTaxableOrderSubTotal()
{
var
taxableOrderSubTotalAmnt = 0.00;
var
radGrid = $find(
'<%= RadGrid1.ClientID %>'
);
var
masterTableView;
var
tableViewRows;
var
length = 0;
if
(radGrid) {
masterTableView = radGrid.get_masterTableView();
}
if
(masterTableView) {
tableViewRows = masterTableView.get_dataItems();
}
if
(tableViewRows) {
length = tableViewRows.length;
}
if
(masterTableView) {
if
(length > 0) {
for
(
var
i = 0; i < length; i++) {
var
dataItem = masterTableView.get_dataItems()[i];
var
isLITaxable =
false
;
if
(dataItem) {
// 1. Get Taxable Check box value
var
chkTxbl = dataItem.findElement(
"chkTaxableLI"
);
var
liTotalPrice = 0.00;
if
(chkTxbl && chkTxbl.checked) {
// Get Total lineITem Price:
// if litTotalPrice control is found the
//item is in readonly mode
// if txtTotalPrice control is found then
// item is in edit mode
if
(dataItem.findElement(
"litTotalPrice"
)) {
liTotalPrice = dataItem.findElement(
"litTotalPrice"
).value;
}
else
if
(dataItem.findElement(
"txtTotalPrice"
)) {
liTotalPrice = dataItem.findElement(
"txtTotalPrice"
).value;
}
taxableOrderSubTotalAmnt = parseFloat(taxableOrderSubTotalAmnt) + parseFloat(liTotalPrice);
}
}
}
}
}
return
taxableOrderSubTotalAmnt;
}