How can I access the the rows selected in a WebDataGrid on the server side?
For example, I have a WebDataGrid and I've enabled the Selection behavior fot it. I want the user to be able to select a row in the WebDataGrid then click a button which calls server side code to process the selected row (i.e. getting the values of some of the columns of the selected row).
I think I need to use the SelectedRowsCollection somehow, but not sure how to use it with my WebDataGrid.
Thanks,
John
Alex,
I'm one step closer, but I can't seem to read the records in the SelectedRows collection. Here's my sample code. When I run it, the selectedRow variable returns null. When I'm debugging, I do see one record selected in wdgFabric.Behaviors.Selection.SelectedRows.
Am I doing something wrong?
// inside my button_clicked method - after I've selected a row
string tmp; if (wdgFabric.Behaviors.Selection.SelectedRows.Count > 0) { foreach (GridRecord selectedRow in wdgFabric.Behaviors.Selection.SelectedRows) // errors out here with selectedRow returning null { tmp = selectedRow.Items.GetValue(1).ToString(); foreach (GridRecordItem selectedRowItem in selectedRow.Items) { Label2.Text = selectedRowItem.Text.ToString(); } } }