I've spent the last few hours looking through the forums, as I suspect what I am doing is common. So I am hoping you can point me to a sample of how to do this.
All I am looking to do is parse the rows of a grid and capture the values in a couple of columns, then use that to call an AJAX class.
Here's the basic idea. The web page loads a list of users with fields for first, middle, and last. There is an execute search button that will run through the grid rows and capture the first, middle, last name and fire off an Ajax call that will verify if the name was found in our database. When that button is pressed, it calls a JavaScript function. That function needs to start with the first row, capture the first, middle, and last name columns values, and execute the search using AJAX. The search will return a boolean, which will then be displayed as a string in the last column on the grid.
I'm thinking something like the following, but I do not know how to get the parsing of the grid and rows to work correctly.
Can you point me to a sample or explain how to do this?
Best regards,
Jon
All I am looking to do is parse the rows of a grid and capture the values in a couple of columns, then use that to call an AJAX class.
Here's the basic idea. The web page loads a list of users with fields for first, middle, and last. There is an execute search button that will run through the grid rows and capture the first, middle, last name and fire off an Ajax call that will verify if the name was found in our database. When that button is pressed, it calls a JavaScript function. That function needs to start with the first row, capture the first, middle, and last name columns values, and execute the search using AJAX. The search will return a boolean, which will then be displayed as a string in the last column on the grid.
I'm thinking something like the following, but I do not know how to get the parsing of the grid and rows to work correctly.
Can you point me to a sample or explain how to do this?
Best regards,
Jon
function
ExecuteSdnSearch() {
//var grid = $find("<%=RadGrid1.ClientID %>");
grid = $find(
"ctl00_MainContent_RadGrid1"
);
var
masterTableView = grid.get_masterTableView();
for
(
var
i = 0; i < length; i++) {
var
row = masterTableView.get_dataItems[
"Uid"
];
var
cell = masterTableView.getCellByColumnUniqueName(row,
"Uid"
);
if
(cell !=
null
) uid = cell.innerHTML;
cell = masterTableView.getCellByColumnUniqueName(row,
"FirstName"
);
if
(cell !=
null
) firstname = cell.innerHTML;
cell = masterTableView.getCellByColumnUniqueName(row,
"MiddleName"
);
if
(cell !=
null
) middlename = cell.innerHTML;
cell = masterTableView.getCellByColumnUniqueName(row,
"LastName"
);
if
(cell !=
null
) lastname = cell.innerHTML;
// Execute AJAX Search
var
boolResult = AjaxService.SdnSearch(firstname, middlename, lastname, ExecuteSdnSearchCallBack);
}
}
function
ExecuteSdnSearchCallback(bool) {
// Update RadGrid Status Column
cell = masterTableView.getCellByColumnUniqueName(row,
"Status"
);
cell.innerHTML = (string)bool;
}