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
640
identifying ID from cell in pivoted row
posted

I need a way to assign multiple cells in each row their primary key ID that correlates with the primary key in the table after I pivot the data (which I am doing after I pull the records from the database - I'm creating the datatable manually).

For example, there is an orderID = 100 in the parent table, with these records in the child table:

In the database, there is one record per size/quantity:

ORDERID | Primary Key | Size | quantity

100 | SizeID1 | 9 | 12

100 | SizeID2 | 11 | 1

100 | SizeID3 | 15 | 8

 

I will create a datatable so that the records will look like this for the child rows in the grid:

ORDERID | Size 9 | Size 11 | Size 15

100 | 12 | 1 | 8

 

So when the user changes the value for Size 9 (in this case 12 units), I need to know that the cell that holds that quantity is 'SizeID1', and the cell that holds the '1' unit for size 11 is 'SizeID2', and so on.

How do I do that?

Parents
No Data
Reply
  • 505
    posted

    A simple solution would be to have three hidden columns in the child grid:

    ORDERID | Size 9 | Size9ID| Size 11 |Size11ID| Size 15|Size15ID

    100 | 12 |SizeID1| 1|SizeID2 | 8|SizeID3

     

    The size ids column will be hidden. You can easily get the changed ids when looking for changed cells.

Children