Current filter:
                                You should refresh the page.
                                Support Center

                                How to filter selected / unselected ASPxGridView's DataRows

                                0

                                The example demonstrate how to filter ASPxGridView's DataRows based on the Selection state. The outside ASPxComboBox editor performs a custom ASPxGridView callback and determines the filtering mode. ASPxGridView's FilterExpression is combined via the InOperator / GroupOperator objects - special types for data filtering.

                                See Also:
                                DevExpress.Data.Filtering Namespace

                                You must  log in  or  register  to leave comments
                                Select file
                                • Default.aspx
                                • Default.aspx.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2013 vol 1.4 - v2013 vol 2.9
                                • v2010 vol 2.6 - v2012 vol 2.16
                                <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
                                
                                <%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
                                
                                <%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
                                
                                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                
                                <html xmlns="http://www.w3.org/1999/xhtml">
                                <head runat="server">
                                    <title></title>
                                    <script type="text/javascript">
                                        function OnSelectedIndexChanged(s, e) {
                                            grid.PerformCallback(s.GetValue());
                                        }
                                    </script>
                                </head>
                                <body>
                                    <form id="mainForm" runat="server">
                                    <div>
                                        <dx:ASPxComboBox ID="cmbFilterMode" runat="server" ValueType="System.String" SelectedIndex="0">
                                            <Items>
                                                <dx:ListEditItem Text="All" Value="All" />
                                                <dx:ListEditItem Text="Selected" Value="Selected" />
                                                <dx:ListEditItem Text="UnSelected" Value="UnSelected" />
                                            </Items>
                                            <ClientSideEvents SelectedIndexChanged="OnSelectedIndexChanged" />
                                        </dx:ASPxComboBox>
                                        <dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" ClientInstanceName="grid"
                                            DataSourceID="gridDataSource" KeyFieldName="ProductID" 
                                            OnCustomCallback="grid_CustomCallback">
                                            <Columns>
                                                <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                                                </dx:GridViewCommandColumn>
                                                <dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" 
                                                    VisibleIndex="0">
                                                    <EditFormSettings Visible="False" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="1">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="SupplierID" VisibleIndex="2">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="CategoryID" VisibleIndex="3">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                        </dx:ASPxGridView>
                                    </div>
                                    <asp:AccessDataSource ID="gridDataSource" runat="server" 
                                        DataFile="~/App_Data/nwind.mdb" 
                                        SelectCommand="SELECT [ProductID], [ProductName], [SupplierID], [CategoryID] FROM [Products]"></asp:AccessDataSource>
                                    </form>
                                </body>
                                </html>

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners