Hi
I have a Grid with NestedView Table which I create programmatically.
Each row on the child table has a checkbox field which selects the whole row.
It has a custom Command header with an Image Button which is acting like an "Add to Cart" button.
When the button is clicked, I can access the selected child items like so:
}
I actually need to make a javascript call to some existing code with the list of selected items. I have tried to access the same information from the client side but it isnt working - I just get null values - or not selected???
This is my js function
What am I missing please?
I have a Grid with NestedView Table which I create programmatically.
Each row on the child table has a checkbox field which selects the whole row.
It has a custom Command header with an Image Button which is acting like an "Add to Cart" button.
When the button is clicked, I can access the selected child items like so:
if
(e.CommandName ==
"AddToCart"
)
{
if
(RadGrid1.SelectedIndexes.Count == 0)
{
RadWindowManager1.RadAlert(
"No documents have been selected"
, 250, 100,
"Add to Document Cart"
,
""
);
return
;
}
GridCommandItem Item = (GridCommandItem)e.Item;
ImageButton btnAddToCart = (ImageButton)e.Item.FindControl(
"btnAddSelectedToCart"
);
System.Collections.ArrayList doclist =
new
System.Collections.ArrayList();
foreach
(GridDataItem item
in
RadGrid1.SelectedItems)
{
doclist.Add(
new
HRTDocData(Convert.ToInt32(item[
"RecordID"
].Text), Convert.ToInt32(item[
"DocID"
].Text), item[
"DocTypes"
].Text, item[
"DocReferences"
].Text, item[
"DocContents"
].Text));
}
I actually need to make a javascript call to some existing code with the list of selected items. I have tried to access the same information from the client side but it isnt working - I just get null values - or not selected???
This is my js function
function
GetChildValues() {
var
grid = $find(
"<%=RadGrid1.ClientID %>"
);
var
MasterTable = grid.get_masterTableView();
var
selectedRows = MasterTable.get_selectedItems();
for
(
var
i = 0; i < selectedRows.length; i++) {
var
row = selectedRows[i];
var
cell = MasterTable.getCellByColumnUniqueName(row,
"RecordID"
)
alert(cell);
}
What am I missing please?