AspxGridView and ShowHeaderFilterButton property
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);
}
精彩评论