Current filter:
                                You should refresh the page.
                                Support Center
                                  • Hello,

                                    I am working in a Web xaf application, where I have a listview where I show some products, and a detail view to access to more information of the product. If I apply a filter using the text searcher and I enter to a detail of one of the filtered products, when I go back to the list view the text filter has been removed.

                                    Is it possible to keep this filter going back from the detail view?

                                    Thank you.

                                1 Solution

                                Creation Date Rating Importance Sort by
                                Hello Joan,

                                Sure, that is possible using a relatively simple Controller:
                                using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Model; using DevExpress.ExpressApp.SystemModule; using DevExpress.ExpressApp.Web.SystemModule; namespace MainDemo.Module.Web.Controllers { public class WebPreserveFullTextSearchResultsListViewController : ViewController<ListView>, IModelExtender { private FilterController filterController = null; protected override void OnActivated() { base.OnActivated(); string parameter = ((IModelListViewFullTextSearch)View.Model).FullTextSearchParameter; filterController = Frame.GetController<FilterController>(); if(filterController != null) { if(!String.IsNullOrEmpty(parameter)) { filterController.FullTextFilterAction.DoExecute(parameter); } filterController.FullTextFilterAction.Execute += FullTextFilterAction_Execute; } } protected override void OnDeactivated() { if(filterController != null) { filterController.FullTextFilterAction.Execute -= FullTextFilterAction_Execute; } base.OnDeactivated(); } void FullTextFilterAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) { ((IModelListViewFullTextSearch)View.Model).FullTextSearchParameter = (String)e.ParameterCurrentValue; } public void ExtendModelInterfaces(ModelInterfaceExtenders extenders) { extenders.Add(typeof(IModelListViewWeb), typeof(IModelListViewFullTextSearch)); } } public interface IModelListViewFullTextSearch { string FullTextSearchParameter { get; set; } } }
                                Imports System Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Actions Imports DevExpress.ExpressApp.Model Imports DevExpress.ExpressApp.SystemModule Imports DevExpress.ExpressApp.Web.SystemModule Namespace MainDemo.Module.Web.Controllers Public Class WebPreserveFullTextSearchResultsListViewController Inherits ViewController(Of ListView) Implements IModelExtender Private filterController As FilterController = Nothing Protected Overrides Sub OnActivated() MyBase.OnActivated() Dim parameter As String = DirectCast(View.Model, IModelListViewFullTextSearch).FullTextSearchParameter filterController = Frame.GetController(Of FilterController)() If filterController IsNot Nothing Then If Not String.IsNullOrEmpty(parameter) Then filterController.FullTextFilterAction.DoExecute(parameter) End If AddHandler filterController.FullTextFilterAction.Execute, AddressOf FullTextFilterAction_Execute End If End Sub Protected Overrides Sub OnDeactivated() If filterController IsNot Nothing Then RemoveHandler filterController.FullTextFilterAction.Execute, AddressOf FullTextFilterAction_Execute End If MyBase.OnDeactivated() End Sub Private Sub FullTextFilterAction_Execute(ByVal sender As Object, ByVal e As ParametrizedActionExecuteEventArgs) DirectCast(View.Model, IModelListViewFullTextSearch).FullTextSearchParameter = CStr(e.ParameterCurrentValue) End Sub Public Sub ExtendModelInterfaces(ByVal extenders As ModelInterfaceExtenders) extenders.Add(GetType(IModelListViewWeb), GetType(IModelListViewFullTextSearch)) End Sub End Class Public Interface IModelListViewFullTextSearch Property FullTextSearchParameter() As String End Interface End Namespace

                                Check out the following concepts to learn more about this implementation:
                                    Concepts > Extend Functionality > Customize Controllers and Actions
                                    DevExpress.ExpressApp.SystemModule > FilterController
                                    Task-Based Help > How to: Extend the Application Model

                                I am looking forward to hearing from you.

                                • JOAN PONT 05.22.2017

                                  That's exactly what I was looking for.

                                  Thank you so much.
                                • You're always welcome, Joan!
                                • Daniel Raúl Vanzo 06.12.2017
                                  Any way to have the code? I tried to convert it but without luck..

                                • @Daniel: I've added VB.NET code. BTW, you can always use free or paid converter tools available on the Web. I hope you find this tip helpful for the future, because the majority of our SC tickets are submitted by C# users.

                                If you need additional product information, write to us at 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, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

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