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
412
programatically selecting row in code behind
posted

 I have a ultrawebgrid and when a user clicks on the row I want another ultrawebgrid to have the same seleted row.  Something like this...

 

Dim selectedRow As UltraGridRow = wg1.DisplayLayout.SelectedRows(0)
wg2.DisplayLayout.ActiveRow = selectedRow

Parents
  • 45049
    posted

    First, you're mixing the concepts of "selected rows" and "active rows" between the two grid.  An active row either has input focus or contains the cell that has input focus; the grid either has either exactly zero or one active rows at a time.  By comparison, if you turn on row selection, you may have zero, one, or many selected rows at a time, any or none of which may be the active row.

    Second, you can't set the active row in one WebGrid to be a row that exists in another WebGrid.  Even if the two contain the same data, each row object is independent of each other.  Instead, get some information from the appropriate row in one of your grids that allows you to uniquely identify it; a primary key is useful if your data has it.  Then, find the corresponding row in the other grid that matches your unique identification, and select or activate that row as desired.

Reply Children