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
105
Get selected row ultra grid and put in another ultra grid data source
posted
Hi, 

Is there a possibility to get the selected rows of one grid
and put them inside the data source of another grid?

I know that I need to use this line code:

Ultragrid1.SelectedRows = Ultragrid1.Rows(0)
Ultragrid2.Datasource =?

But I don't know if it's correct, because i don't know how then to insert it
inside the data source.

Thanks
Parents
  • 1700
    Offline posted

    Hello Camilla,

    You can insert the selected rows of one grid to another by obtaining its selected rows collection and then adding it to a data source of your choice. In the case of the sample that I am attaching, I am using data table as the data source of the second grid. For each selected row, a data row is created in the data table, after that the data row is populated by the contents of the cells of the row that is being iterated and then the data table is assigned as the data source for the grid and the rows collection is cleared.

    Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce.

    Additionally, if you want to add rows to the selected rows collection programmatically you can do this by using the following line:

    ultraGrid1.Selected.Rows.Add(ultraGrid1.Rows(1))

    Let me know if you have any questions.

    Regards,
    Ivan Kitanov

    LoadSelectedRowsToAnotherGrid.zip

Reply Children