Same asp: GridView in different ajaxToolkit: TabPanel

I need to filter GridView data based on the selected tab, Here is the scenario:

I have the following tabs

All | Tab A | Tab B | Tab C

When I click on the All tab I get 10 records and my GridView contains 10 records, But when I click on Tab A my GridView should filter and show 5 records
Right now I am using a separate GridView for each tab and anchor to the same DataSourceID.
And using the OnActiveTabChanged event to filter the data, but this calls the base method to execute 4 times (due to 4 tabs), no UI issues, but there is a performance issue ...
I'm trying to see if I can use: Same GrigView in all tabs for this type of scenario

Any help is greatly appreciated, thanks!

0


a source to share


2 answers


If you want to use one GridView across all tabs, try calling the base method (which populates the GridView) on OnPreRender instead of OnActiveTabChanged. Make it conditional which tab is active and filter accordingly.



0


a source


You can use the RowFilter property on the DataView and apply each tab to the one you need.



those. DataView1.RowFilter = "Column = 'ColumnValue'" then set datasource / databind.

0


a source







All Articles