How do you retrieve data from a specific cell in a selected row? With the ultrawebgrid control, I used to do something like this:
e.Row.Cells.FromKey("ColumnName").Value
With the webdatagrid control, I saved all the selected rows in a SelectedRowCollection variable. How do I access the data, as I did above, for a specific cell in a row in that collection?
Thanks!
It depends upon whether you are accessing a cell on the client or server.
Assuming you have the row on the server- row.Items["key"] or row.Items[0] gives you a GridRecordItem
On the client, you can get a cell by index, column key, or column reference off a row as follows.
row.get_cell(0), row.get_cellByColumnKey("key"), row.get_cellByColumn(keyCol)
Off of the cell, you can get text by .Text on the server or .get_text() on the client.
regards,
David Young
When I use row.Items to access rows on the server there is only a method constructor to enter a column index number - row.items[0]. It doesn't allow me to enter a key - row.Items["key"].
Yeah, looks like that was my mistake. A way to accomplish that would be to get the index off of a column that you found by the key.
int index = this.WebDataGrid1.Columns["key"].Index;
GridRecordItem cell = this.WebDataGrid1.Behaviors.Selection.SelectedRows[0].Items[index];
regards,Dave