Tutorial :How to disable the users abilities for the Devexpress GridView


I am using the DevExpress.XtraGrid.Views.Grid.GridView within my Visual Studio 2008 application and thought I limited the abilities of the user but I was mistaken. I am programming in VB.NET but I can easily translate from C#.

I went into the properties of the gridview and set ShowGroupPanel, AllowAddRows, AddNewColumns, AllowDeleteRows, RemoveOldColumns, and Editable to false. Doing this I thought I disabled the ability of the user to delete, add and update rows along with disabling the grouping panel.

However I ran the program and when I select a row and press delete the program complains that I don't have a deleteStoredProcedure set. I looked this up and the here it tells me to disable the command column

((GridViewCommandColumn)ASPxGridView1.Columns["CommandColumn"]).EditButton.Visible = Convert.ToBoolean(e.Parameters);  

Yet when I loop through my columns I don't have a command column. This site tells me to catch the delete button press using GridView1_CommandButtonInitialize but I can't access CommandButtonInitialize.

In addition I discovered if I right click on the grid while the program is running I am able to make the group by panel show up which I specifically thought I disabled. Also by right-clicking I can open the column chooser which allows the user to access the columns that I don't want them to see and set to visible=false.

How do I completely disable the ability of the user to delete rows, open/use the column chooser and show the group by panel in the DevExpress Gridview?


I'm using a DevExpress.XtraGrid.Views.Grid.GridView within a DevExpress.XtraEditors.PanelControl on a DevExpress.XtraEditors.XtraForm.

I wasn't able to find any examples that were specifically for DevExpress.XtraGrid.Views.Grid.GridView though the first link (ASP.NET) is from the DevExpress site so I was hoping they would have some correlation.


OK :)

You should set the columns' OptionsColumn.AllowGroup and OptionsColumn.AllowShowHide property to false. In this case, the end-user won't be able to group by a column or move this column to the CustomizationWindow. If you wish to remove the corresponding items from the menu, please refer to the

How to disable particular menu items in the default grid menus


Finally, the grid does not delete rows from the underlying DataSource if the Delete key is pressed. There is no this functionality embedded in the Grid. So, I think that there should be some code in your application when rows are deleted programmatically ...

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »