I need to create a gridview off a pivoted version of the following table layout: Person 1..N PersonDate N...1 Date: i.e.
Person PersonDate Date PersonID Person PersonID DateID Flag DateID Date 1 John 1 1 Y 1 01/01/2018 2 Jane 1 2 N 2 02/01/2018 2 2 N
But I need to pivot this into a gridview, such that the gridview column structure looks like:
Person 01/01/2018 02/01/2018 John Y N Jane N
The columns are dynamically generated as more dates are added in. I've achieved this via use of a datatable. But I also need to add a button into each cell on the gridview's result to toggle the flag.
How can I insert a button into a column that isn't present until runtime? I thought about using onrowcreated, but then how do I distinguish between the buttons when one is clicked?
Alternatively, is there a better way to achieve this?