如何禁用 Devexpress GridView 的用户能力

发布于 2024-09-11 03:50:45 字数 1461 浏览 2 评论 0原文

我在 Visual Studio 2008 应用程序中使用 DevExpress.XtraGrid.Views.Grid.GridView,并认为我限制了用户的能力,但我错了。我正在使用 VB.NET 进行编程,但我可以轻松地从 C# 进行转换。

我进入 gridview 的属性并设置 ShowGroupPanelAllowAddRowsAddNewColumnsAllowDeleteRowsRemoveOldColumnsEditable 为 false。这样做我认为我禁用了用户删除、添加和更新行的能力以及禁用分组面板。

但是,我运行了该程序,当我选择一行并按删除时,程序抱怨我没有设置 deleteStoredProcedure。我查了一下,这里它告诉我禁用该命令然而

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

,当我循环浏览我的列时,我没有命令列。 网站告诉我使用捕获删除按钮按下GridView1_CommandButtonInitialize,但我无法访问 CommandButtonInitialize

此外,我发现如果我在程序运行时右键单击网格,我可以使 group by panel 显示出来,我特意认为我禁用了它。另外,通过右键单击,我可以打开列选择器,它允许用户访问我不希望他们看到的列,并将其设置为visible=false

如何完全禁用用户删除行、打开/使用列选择器以及在 DevExpress Gridview 中显示分组面板的能力?

编辑:

我在 DevExpress.XtraEditors.XtraForm 上的 DevExpress.XtraEditors.PanelControl 中使用 DevExpress.XtraGrid.Views.Grid.GridView >。

尽管第一个链接(ASP.NET)来自 DevExpress 站点,但我找不到任何专门针对 DevExpress.XtraGrid.Views.Grid.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?

EDIT:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃颗糖壮壮胆 2024-09-18 03:50:45

好的:)

您应该将列的 OptionsColumn.AllowGroup 和 OptionsColumn.AllowShowHide 属性设置为 false。在这种情况下,最终用户将无法按列进行分组或将此列移动到 CustomizationWindow。如果您希望从菜单中删除相应的项目,请参阅

如何禁用默认网格菜单中的特定菜单项

一文。

最后,如果按下删除键,网格不会从基础数据源中删除行。网格中没有嵌入此功能。所以,我认为当以编程方式删除行时,您的应用程序中应该有一些代码......

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

article.

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 ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文