I have a webDataGrid with addRow enabled. If the grid is not empty, I need to copy some values from the last row of the grid into addRow colums. How do I access the values in the last row of the gridview? I am trying to do so using RowAdding_EnteringEditMode(sender, eventArgs) in javascript, but I can't find the values.
Hi Jesse,
I am still following this thread and wanted to check back to see if you needed any further assistance.
Are you tying to get the values of a selected row? If so, you can do something like this:
function getRows() {
var grid = $find("<%=webdatagrid1.clientid>");
alert(grid.get_behaviors().get_selection().get_selectedRows().getItem(0).get_element().innerText);
}
You will need to ensure that you have the selection behavior enabled on the grid for this to work.
If your intent is not to base this off a user action but do this entirely on the client, you will need to tell the code which row you want the values for, so you will need to add the row(s) to the selected rows collection first, so something like this:
function SelectRow() { var grid = $find("WebDataGrid1"); // my DataGrid has an Id of WebDataGrid1 var gridRow = grid.get_rows().get_row(0); grid.get_behaviors().get_selection().get_selectedRows().add(gridRow); }
Let me know if you need any additional assistance regarding this.