开发者

AspxGridView and ShowHeaderFilterButton property

开发者 https://www.devze.com 2023-02-10 22:28 出处:网络
my question is very simple. I have an AspxGridView with a DataTable as datasource. Whene i filter rows by using the combox enabled by the ShowHeaderFilterButton property, the datasource is not u开发者

my question is very simple. I have an AspxGridView with a DataTable as datasource. Whene i filter rows by using the combox enabled by the ShowHeaderFilterButton property, the datasource is not u开发者_JS百科pdated and my row count remain the same.

How can i count the rows not hidden?


The ASPxGridView does not apply a filter condition on the underlying DataSource. So, after the filtering is done, the grid's DataSource has the same record count as it had before. A possible solution to this problem is to traverse through gridRows and getting required KeyField values or Row objects:

object[] rows = new object[ASPxGridView1.VisibleRowCount];
        for(int i = 0; i < ASPxGridView1.VisibleRowCount; i++) {
            rows[i] = ASPxGridView1.GetRowValues(i, ASPxGridView1.KeyFieldName);
            //or
            rows[i] = ASPxGridView1.GetRow(i);
        } 
0

精彩评论

暂无评论...
验证码 换一张
取 消