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

                                    I have looked in the documentation and support tickets and I cannot find where I can set the default number of items (pagesize) setting for all my listviews in the model editor as per this support ticket


                                    Anatol says

                                     However, the PageSize property will be overridden with values from the Application Model. To define the page size, assign the Views | ListView | PageSize property in the Model Editor.

                                    I cannot find this!

                                    I want to change it from the default 20 to 50 on all listviews.

                                    please can you help


                                1 Solution

                                Creation Date Rating Importance Sort by

                                Hello Chris,

                                To change the default page size globally, consider one of the following solutions depending on your business needs (they are listed in the order of preference or simplicity):

                                1. Perform Application Model customizations via the Model Editor invoked at design time or at runtime. 
                                For instance, you can change the default IModelListView.PageSize value for each Views | ListView node manually using the Model Editor. This manual process can be inappropriate if there are too many ListView nodes where you want to apply these changes.

                                2. Automate Application Model customizations using one of the methods below or their combination.
                                2.1. Create a Model Nodes Generator Updater class for the ModelViewsNodesGenerator type, iterate through all ListView models in it and change their IModelListViewWeb.PageSize property. Refer to the Extend and Customize the Application Model in Code topic and the code snipped below for additional information:

                                using System; using System.Linq; using System.ComponentModel; using DevExpress.ExpressApp; using System.Collections.Generic; using DevExpress.ExpressApp.Model; using DevExpress.ExpressApp.Updating; using DevExpress.ExpressApp.Model.Core; using DevExpress.ExpressApp.Web.SystemModule; using DevExpress.ExpressApp.Model.NodeGenerators; namespace MainDemo.Module.Web { public sealed partial class MainDemoWebModule : ModuleBase { public MainDemoWebModule() { InitializeComponent(); } public override void AddGeneratorUpdaters(ModelNodesGeneratorUpdaters updaters) { base.AddGeneratorUpdaters(updaters); updaters.Add(new T271022()); } internal class T271022 : ModelNodesGeneratorUpdater<ModelViewsNodesGenerator> { public override void UpdateNode(ModelNode viewsNode) { foreach(IModelListViewWeb modelListView in ((IModelViews)viewsNode).Where(mv => mv is IModelListViewWeb)) { modelListView.PageSize = 50; } } } ... } }

                                Take special note that node generators and node updaters work at the "zero" layer and thus have no access to higher Application Model layers where cloned/copied nodes or other model differences reside. Also, all customizations made at this time will NOT be saved in user model differences. This is the default behavior of the Application Model and you can learn more about it from the eXpressApp Framework > Concepts > Application Model > Application Model Basics article.

                                Implement a custom Get domain logic for the required property. See an example in the Change the default value in application model ticket. Note that this logic should always return a value, and the default value cannot be obtained. So, use this solution only when it is necessary to override all values. The Get domain logic is executed each time the value of the corresponding model property is requested. So, this approach may be useful when it is necessary to calculate a property value based on runtime variables, such as the current user name.

                                Handle various events of the XafApplication and other objects after the Application Model was generated:
                                    SetupComplete  - if you want to perform adjustments before user differences are loaded. All customizations made at this time will NOT be saved in user model differences.
                                    UserDifferencesLoaded  - if you want to perform adjustments after the user differences are loaded. All customizations made at this time or in later events will be saved in the user model differences as well, which may increase their size.
                                    ViewCreatingListViewCreating and similar events - have the same effect as the UserDifferencesLoaded event, but the changes will be applied on demand, after each View is really created in the UI and not at once (aka "lazy loading").

                                The code example below demonstrate how these events can be handled in the YourSolutionName.Module/Module.cs file:

                                using System; using System.Linq; using DevExpress.ExpressApp; using System.Threading.Tasks; using DevExpress.ExpressApp.Model; namespace MainDemo.Module { public sealed partial class MainDemoModule : ModuleBase { public override void Setup(XafApplication application) { base.Setup(application); application.ListViewCreating += application_ListViewCreating; application.UserDifferencesLoaded += CustomizeAllViewsAtOnceDemo; application.SetupComplete += CustomizeAllViewsAtOnceDemo; } void CustomizeAllViewsAtOnceDemo(object sender, EventArgs e) { Parallel.ForEach(((XafApplication)sender).Model.Views.OfType<IModelListView>(), modelListView => modelListView.MasterDetailMode = MasterDetailMode.ListViewAndDetailView); } void application_ListViewCreating(object sender, ListViewCreatingEventArgs e) { IModelListView modeListView = ((XafApplication)sender).FindModelView(e.ViewID) as IModelListView; if(modeListView != null) { modeListView.MasterDetailMode = MasterDetailMode.ListViewAndDetailView; } } public MainDemoModule() { InitializeComponent(); } } }


                                3. Do not perform customizations at the Application Model level, but rather customize the control directly where possible.
                                For instance, you can implement a ViewController to access ASPxGridView and customize its SettingsPager.PageSize property.
                                See the Access Grid Control Properties in ASP.NET Web Applications help topic for sample code.

                                IMPORTANT NOTES:
                                Any changes made to the Application Model are not immediately reflected in the UI. Customize the application model before the control used to display the target UI element is created and loaded. If it is necessary to customize the UI element after its control is created and initialized with default settings, access the control directly (see Access Editor Settings, Access Grid Control Properties, etc.).

                                See Also:
                                How to refresh View appearance after making changes to the Application Model in code
                                Concepts > Application Model > Extend and Customize the Application Model in Code

                                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