Ticket S37239
Visible to All Users

Performance.Web - Use data-specific column types instead of data item templates whenever possible

created 14 years ago

Data item templates are not always required. Without unnecessary templates our web list editors will be rendered faster, especially in IE that has low tables rendering speed.
Here is some example code:

C#
using DevExpress.ExpressApp; using DevExpress.ExpressApp.Web.Editors.ASPx; using DevExpress.Web.ASPxGridView; namespace YourSolutionName.Module.Web { public class RemoveCustomTemplatesFromGridColumns : ViewController<ListView> { ASPxGridListEditor gridListEditor; protected override void OnActivated() { base.OnActivated(); gridListEditor = View.Editor as ASPxGridListEditor; if(gridListEditor != null) { gridListEditor.EnableGroupTemplate = false; } } protected override void OnDeactivated() { gridListEditor = null; base.OnDeactivated(); } protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); if(gridListEditor != null) { foreach(GridViewColumn column in gridListEditor.Grid.Columns) { if(column is GridViewDataColumn && !(column is GridViewDataActionColumn)) { ((GridViewDataColumn)column).DataItemTemplate = null; ((GridViewDataColumn)column).EditItemTemplate = null; } } } } } }

Take special note that XAF provides custom data and edt item and group ITemplate objects as part of the PropertyEditor creation for each column to deliver a generic way to control data validation, formatting, localization and other XAF features. They will be lost when this code is used, but perhaps you do not need them in certain scenarios.
Alternatively, to improve performance of large grids with a lot of records and columns you can do the following:

  1. Create a new ListEditor using the ASPxGridView control as it is described in the How to: Implement an ASP.NET Web List Editor Using a Custom Control.
  2. Implement a custom ViewItem based on a user control with the same ASPxGridView and show a dashboard View from the navigation as it is demonstrated at How to show custom forms and controls in XAF (Example).
    Options #1-2 are pretty similar and basically vary by the container where a pure ASPxGridView will reside.
    See Also:
    ASPxGridView very slow with 30 properties
    Group By panel problem
Comments (1)
Dennis Garavsky (DevExpress) 13 years ago

    UPDATE:
    Starting from version 12.1, to have a greater performance (a dozen times better under certain circumstances) in grids with grouped columns you can set the EnableGroupTemplate property of ASPxGridListEditor to False before the editor's controls are created (e.g. during the ViewController's activation).
    Take special note that setting this property will completely remove templates from reference and enumeration properties so that they will be displayed as plain text using standard ASPxGridView capabilities (see the attached screenshot - as you see there is no hyper link for an object shown in the group).
    So, this solution may be not suitable if you require localized values for enumerations gotten from the application model for more than one language.
    Of course, this is not the final solution and we will certainly explore other solutions to decrease page loading and keep the standard rich functionality.
    Thanks,
    Dennis

    Answers approved by DevExpress Support

    created 10 years ago (modified 10 years ago)

    We have implemented the functionality described in this ticket. It will be included in our next update(s).

    Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

    Additional information:

    We extended our code to use data-specific column types whenever possible. The use of data-specific columns for simple types like System.String, System.DateTime, System.Boolean, etc. allows reducing the request processing time on the server side, reducing rendering time in the browser and reducing traffic due to the simplified page structure.

    Please note the following limitations of the new mode:
    - You cannot navigate to a referenced object by clicking a cell that displays a reference property. You can learn more on how to revert back links for reference columns from the T183808 ticket.
    - The "N/A" text is not displayed for null reference values.
    - Group rows display a plain text by default. You can learn more on how to customize this behavior from the T218619 ticket.

    If you want to revert back to the old mode for any reason, set the static ASPxGridListEditor.UseASPxGridViewDataSpecificColumns property to false in the Global.asax.cs (Global.asax.vb) file:

    Code
    protected void Application_Start(Object sender, EventArgs e) { ASPxGridListEditor.UseASPxGridViewDataSpecificColumns = false; // ... }

    See also:  Data-Specific Column Types for ASPxGridView

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.