Power Pages – Make grids behave just like they do on tasks

How Can We Help?

< Back

When using DevExpress GridView controls in your Power Pages, you may want to make their configuration consistent with the grids created by regular XMPro tasks.

This can be achieved by changing the settings on the ASPxGridView control, for example, setting the position of the pager, enabling grouping by default, and configuring a similar filtering experience.

Note: The below snippet assumes that grid is of type DevExpress.Web.ASPxGridView

     //Header
     grid.Styles.Header.Wrap = DefaultBoolean.True;

     //Grouping
     grid.Settings.ShowGroupPanel = true;

     //Enabled Alternating Row
     grid.Styles.AlternatingRow.Enabled = DefaultBoolean.True;
     grid.Styles.AlternatingRow.BackColor = Color.WhiteSmoke;

     //Hot Tracking
     grid.SettingsBehavior.EnableRowHotTrack = true;

     //Paging
     grid.SettingsPager.Position = PagerPosition.TopAndBottom;
     grid.SettingsPager.PageSize = 20;
     grid.SettingsPager.PageSizeItemSettings.Visible = true;
     grid.SettingsPager.PageSizeItemSettings.Position = PagerPageSizePosition.Right;
     grid.SettingsPager.EnableAdaptivity = true;

     //Resizing
     grid.SettingsResizing.ColumnResizeMode = ColumnResizeMode.Control;

     //EmptyDataRow
     grid.SettingsText.EmptyDataRow = "No records found";

     //Status Bar
     grid.Settings.ShowStatusBar = GridViewStatusBarMode.Auto;

     //ViewState
     grid.EnableViewState = false;

This should give you a grid that looks and behaves similar to an XMPro grid.

Since you would need to do this for every ASPxGridView control you add to a Power Page, it makes sense to wrap this up in an extension method (or something similar) so that it can be easily reused.

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X