简体   繁体   English

相同的asp:GridView在不同的ajaxToolkit:TabPanel中

[英]Same asp:GridView in different ajaxToolkit:TabPanel

I have to filter GridView data based on the Tab Panel selected, Here is the scenario: 我必须根据所选的选项卡面板过滤GridView数据,这是场景:

I have the following tabs 我有以下标签

All | 全部| Tab A | 标签A | Tab B | 标签B | Tab C 标签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 当我单击“全部”选项卡时,我得到10条记录,而我的GridView包含10条记录,但是当我单击选项卡A时,我的GridView需要过滤并显示5条记录
Right now, I am using the separate GridView for each tab and binding to same DataSourceID. 现在,我为每个选项卡使用单独的GridView并绑定到相同的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... 并使用OnActiveTabChanged事件来过滤数据,但这正在调用底层方法执行4次(由于有4个选项卡面板),用户体验没有问题,但是存在性能问题...
I am trying to see, if I can use the : Same GrigView in all the Tab Panels for this type of scenario 我正在尝试查看是否可以在所有类型的方案的所有选项卡面板中使用相同的GrigView

Any help is much appreciate, thanks!! 任何帮助都非常感谢,谢谢!

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. 如果要在所有选项卡上使用单个GridView,请尝试调用OnPreRender(而不是OnActiveTabChanged)中的基础方法(填充GridView)。 Make it conditional on which tab is active, and filter accordingly. 以哪个选项卡处于活动状态为条件,并进行相应的过滤。

You can use the RowFilter property on a DataView and have each tab apply the one you need. 您可以在DataView上使用RowFilter属性,并使每个选项卡应用所需的选项卡。

ie DataView1.RowFilter = "Column='ColumnValue'" then set the datasource/databind. 即DataView1.RowFilter =“ Column ='ColumnValue'”然后设置数据源/数据绑定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM