简体   繁体   English

如何在DevExpress ASPxGridView中按选定的行过滤

[英]How to filter by selected rows in DevExpress ASPxGridView

I want to do something like this 我想做这样的事情

grid.ApplyFilter("[Selected] == \'true\'");

to apply a filter by selected row in my grid. 按我的网格中的选定行应用过滤器。

The column I want to filter by is 我要过滤的列是

        <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="10px">
            <HeaderTemplate>                                                        
                <input type="checkbox" onclick="gvGridView.SelectAllRowsOnPage(this.checked);" />
            </HeaderTemplate>
        </dx:GridViewCommandColumn>
private DataRow SelectRoW()
    {
        DataRow[] objDataRows = null;

            if (gridView1 == null || gridView1.SelectedRowsCount == 0)
            { return null; }//end if
            else
            {
                objDataRows = new DataRow[gridView1.SelectedRowsCount];
                for (int i = 0; i < gridView1.SelectedRowsCount; i++)
                {
                    objDataRows[i] = gridView1.GetDataRow(gridView1.GetSelectedRows()[i]);
                }//end for

                gridView1.BeginSort();
                try
                {
                    foreach (DataRow row in objDataRows)
                    {
                        return row;//return selected row.
                    }//end foreach
                }//end try
                finally
                {
                    objDataRows = null;
                    gridView1.EndSort();
                }//end finally


            }//end else

        return null;
    }//end SelectRoW

This feature is not supported as the out of box functionality. 不支持此功能,因为它具有开箱即用功能。 However, we have just created a new example showing how this can be done and published it on our web site. 但是,我们刚刚创建了一个新示例,展示了如何完成此操作并将其发布在我们的网站上。 Here is the link to it: 这是它的链接:

How to filter selected / unselected ASPxGridView's DataRows 如何筛选选定/未选定的ASPxGridView的DataRows

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

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