Search code examples
c#advanceddatagrid

Get the datasource of current tab in an advanced banded gridview


I have an advanced banded gridview inside a usercontrol which has different tab pages inside it.

I'm trying to find the specific datasource/datatable which is currently displaying.The following both return a table but it returns the same table irrespectively on which tab page I currently have selected.

   ((GridView) sender).DataSource;
   ((GridView) sender).DataController.ListSource;

The closest I could get was using a masterRowExpanded event and doing the following inside it:

((GridView) sender).GetRelationName(e.RowHandle,e.RelationIndex)

and this returned the name of the tab page I was currently on. Any ideas on how to retrieve the source would be greatly appreciated.


Solution

  • After struggling for a while I managed to get it, inside the masterRowExpanded event I used:

    GridView gv = sender as GridView;
    AdvBandedGridView abgv = (AdvBandedGridView)(gv.GetDetailView(e.RowHandle,RelationIndex));
    

    Then the advanced banded gridview had the datasource I was looking for.