tags:

views:

255

answers:

2

I have to filter GridView data based on the Tab Panel selected, Here is the scenario:

I have the following tabs

All | Tab A | Tab B | Tab C

When I click on "All" tab, I get 10 records and my GridView contains 10 records, But when I click on Tab A, my GridView need to filter and show 5 records
Right now, I am using the separate GridView for each tab and binding to same DataSourceID.
And using OnActiveTabChanged event to filter the data, but this is invoking underlying method to-execute 4 times (because of 4 tab panels), no problem with the user experience but there is performance issue...
I am trying to see, if I can use the : Same GrigView in all the Tab Panels for this type of scenario

Any help is much appreciate, thanks!!

A: 

If you want to use a single GridView on all tabs, try invoking the underlying method (that populates the GridView) in OnPreRender instead of OnActiveTabChanged. Make it conditional on which tab is active, and filter accordingly.

Mark Maslar
Thanks you very much for taking time and responding to my question, it is very helpful.I also looked at this artice : http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html , I didn't used javascript (as suggested in this article) but used OnActiveTabChanged event and checked for the active tab and made the other grids in other panels not visible (visible = "false"), I had to refactor little bit for dafults etc... but it's all working fine.
A: 

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

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

Thank you very much for taking time and responding to my question.