For a radgrid, in the GridNeedDataSource Event, the eventargs include: RebindReason IsFromDetailTable
This useful for determining whether the rebinding is caused by Parent or Child grid.
What if I have a 3-tier grid? Parent > Child > Grandchild
This boolean parameter will only tell me whether or not the grid raising the event was开发者_如何学C the parent, it cannot tell me whether it was the Child or Grandchild... or am I missing something?
How can I determine which depth of grid hierarchy raised the event?
EDIT: I suspect I can exploit the sender.Equals() method but I am not sure how to target the detail or master table controls
You should use the DetailTableDataBind
event for this purpose instead. You can refer to the RadGrid programmatic hierarchy binding demo. The DetailTableDataBind event is the recommended approach for binding detail tables. It fires for every detail table that is to be databound. Using the event argument object, you can get the GridTableView instance that is binding (e.DetailTable). If you have specified names for your tables, e.DetailTable.Name
identifies your detail table for the current parent grid item.
Well, I haven't figured out a way to determine that either. What I did is listen for the ItemCommand event of the grid and determine the table view which raised the expand/collapse command through the e.Item.OwnerTableView.Name argument.
Each gridtableview of RadGrid has Name. In DetailTableDataBind you can check name of grid and select the datasource for binding by it...
精彩评论