What I'd like to be able to do is select a grid row, click a button, and pass one of the selected row's cells to another method. Here's the stripped down code I have.
In the grid Initialize Layout event:
.CellClickActionDefault = UltraWebGrid.CellClickAction.RowSelect
.SelectTypeRowDefault = UltraWebGrid.SelectType.Single
.ActivationObject.BorderStyle = BorderStyle.Dotted
.BorderCollapseDefault = UltraWebGrid.BorderCollapse.Collapse
.RowSelectorsDefault = UltraWebGrid.RowSelectors.Yes
End With
In the button click event
sTest = uwgSearch1.DisplayLayout.ActiveCell.Value
I have done this before in other projects and didn't have any trouble. For some reason in this project everytime it posts back I get an object reference error. I'm stuck! Any ideas or suggestions would be appreciated.
Thanks
Jarrod,
There's a difference between an ActiveCell and a SelectedCell. It sounds like focus is being transferred from the grid to the button, when you click on the button to post back. This will remove the ActiveCell and ActiveRow from the grid, since they pertain exclusively to focus - which now belongs to the button. Perhaps if you explain a little more about your scenario and exactly what you're hoping to accomplish (why is the cell they clicked on important), we can offer an alternative solution.
-Tony
Thanks for the reply. The loss of focus makes sense. That may be it.
What I'm trying to setup is multiple grids that are used for drill-down. They will pick a row in the first grid, click a button, and then get further detail in the second grid. To do that, I need to pass the key value of the chosen row from the first grid to populate the second. I know that sounds like a good opportunity to use a hierarchical grid, but I don't think that will work in this case.
Possibly "Selected Cell" or "Selected Row" is an option. I haven't been able to find any information about it though. What would Selected Row's version of this
be?
Thanks - Jarrod.