Gridview within Gridview c#
Posted on 2010-11-26
I have 2 tables (master and detail) that look as follows:
TM_ID - trade master id
TM_O - trade master offering member
TM_R - trade master requested member
TM_D - trade master date
TM_S - trade master status
TD_ID - trade detail id
TM_ID - trade master id (foreign key)
TD_PID - player id
TD_T - trade detail type
These are 2 tables for a fantasy football website that deal with trades between members. I have pages that write values to these tables and the page i'm trying to create is a view of the trade itself. The main gridview will select on the master table and have columns of the 2 members involved, the date, status, and 2 nested gridviews based on the trade detail table.
The nested gridviews will be need to have a query selecting all records based on the TM_ID field and will be separated by the TD_T field (this field will say either OFFER or REQUEST depending on if the player was linked to the offerer or the requestee).
I'm not sure how to populate the child gridviews in this case. I've seen several examples online but none of them make sense to me and am looking for a better example or simply an explanation of how this should work. Examples are preferred so I can try to follow the logic but almost every example I've seen just throws the code out there with no explanation as to the parts that don't seem to make sense. Hoping someone can help me with this!