Ticket T331611
Visible to All Users

ASPxGridView - How to enable editing a column/cell in Batch Edit Mode when filed is custom property editor

created 9 years ago (modified 6 years ago)

Hi Team,
There is a small issue with editing a fields in ASPxGrid in BatchEditMode.
I have applied a Custom Property Editor for all decimal fields in my application. When i am using Inline edit it's working fine. But after upgrading to 15.2 batch edit mode, these Decimal fields are disabled for editing.

I am using my sample code like this in my Custom Editor:

C#
protected override WebControl CreateViewModeControlCore() { ASPxTextBox tb = CreateTbControl(); tb.Enabled = false; return tb; } protected override WebControl CreateEditModeControlCore() { return CreateTbControl(); } private ASPxTextBox CreateTbControl() { ASPxTextBox tb = new ASPxTextBox(); tb.DisplayFormatString = "{0:c2}"; tb.MaskSettings.Mask = "$<0…9999999999999g>.<00…99>"; tb.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.DecimalSymbol; return tb; }

How to enable them? Any help… Thanks in advance.

Answers approved by DevExpress Support

created 9 years ago (modified 2 years ago)

Hello,

When a custom property editor is used for a column, this editor's controls are added to the column through custom templates - DataItemTemplate and EditItemTemplate. The Grid control does not support batch editing for columns where templates are used - this functionality is supported only for editors provided by Data Columns. So, to enable the batch editing functionality, use the built-in property editors in the required columns of your ListView.

To customize inline editors in this case, handle the ASPxGridListEditor.CustomizeGridViewDataColumn event and change the column editor settings (e.g., using the GridViewEditDataColumn.PropertiesEdit and GridViewDataSpinEditColumn.PropertiesSpinEdit properties).

C#
using DevExpress.ExpressApp; using DevExpress.ExpressApp.Web.Editors.ASPx; using DevExpress.Web; namespace MainDemo.Module.Web { public class HideSpinButtonsController : ViewController<ListView> { ASPxGridListEditor gridListEditor; protected override void OnActivated() { base.OnActivated(); gridListEditor = View.Editor as ASPxGridListEditor; if(gridListEditor != null) { gridListEditor.CustomizeGridViewDataColumn += GridListEditor_CustomizeGridViewDataColumn; } } private void GridListEditor_CustomizeGridViewDataColumn(object sender, CustomizeGridViewDataColumnEventArgs e) { if(e.Column is GridViewDataSpinEditColumn gridViewDataSpinEditColumn) { gridViewDataSpinEditColumn.PropertiesSpinEdit.SpinButtons.ShowIncrementButtons = false; } } protected override void OnDeactivated() { base.OnDeactivated(); if(gridListEditor != null) { gridListEditor.CustomizeGridViewDataColumn -= GridListEditor_CustomizeGridViewDataColumn; gridListEditor = null; } } } }

Refer to the following help topic for additional information: Data Columns.

    Comments (2)

      Does this apply to InlineEditMode = Inline or only InlineEditMode = Batch?

      Anatol (DevExpress) 5 years ago

        Hello Jimmy,

        ASPxGridListEditor always uses EditItemTemplate with property editor controls in Inline edit mode. If your custom Property Editor does not work in this scenario, please feel free to create a separate ticket and describe the issue in detail, with code examples or a sample project.

        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.