Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
420
Row selection in a grid
posted

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:

    With uwgGrid1.DisplayLayout

     .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

Parents
No Data
Reply
  • 19308
    posted

    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

Children