0
votes

I have DevExpress ASPxGridView which bind data from the code and columns will add dynamically. I want to set the columns editable. (User should able to type on grid cells) Is there any way to do this? (Something like my code)

For i As Integer = 0 To dgstkReceivd.Columns.Count - 1
        dgstkReceivd.Columns(i).EDITABLE = True
    Next
2
I see that in one comment you are writing that you are using DevExpress grid in Web Forms. XtraGrid is for WinForms. In web, DevExpress has ASPxGridView. Are you using it? Or are you using WinForms XtraGrid in web somehow? - Gosha_Fighten
Yes gosha. . I made mistake. . I want do this for devexpress aspxGridView - Tom

2 Answers

1
votes

Unlike the WinForms Grid, a user has to manually switch the WebForms Grid to Edit mode. DevExpress ASPxGridView provides several Edit modes:

  • Edit Form
  • Popup Edit Form
  • Inline editing
  • Batch editing

See the Data Editing help topic on DevExpress.

For your requirements, I guess, inline and batch edit modes will suite them.

Batch edit mode does not need a user to click the Edit button.

Use the ASPxGridView.SettingsEditing.Mode property to enable the required Edit mode for the Grid. For Edit modes except Batch, you also need to show the Edit button. Use the properties of the Command Column to do this.

Here is a demo: Grid Edit Modes

Updated

To prevent a particular column from being edited, you can use the GridViewDataColumn.ReadOnly property. You can also set the e.cancel parameter of the ASPxClientGridView.BatchEditStartEditing event handler to true to disable editing based on your condition on the client.

0
votes

You can manage whether user can edit the specific column or cannot via the OptionsColumn.AllowEdit option. This option is in effect if the View's ColumnView.Editable property is set to true.

The default state of these options makes columns editable if it possible. For example, if the column in DevExpress XtraGrid is mapped to read-write property of a specific data-object then this column is editable by default.

Related help-articles:
Assigning Editors to Individual Cells
WinForms Grid: Prevent Editing in Specific Cells.