如何根据条件启用/禁用radgrid的行双击编辑属性

发布于 2024-11-27 09:15:23 字数 1652 浏览 1 评论 0原文

我有以下代码

Javascript

function RowDblClick(sender, eventArgs)
                             {
                                window.radopen("SourceFileAdmin.aspx?SourceSystemFileId=" + eventArgs.getDataKeyValue("SourceSystemFileId"), "UserListDialog");
                            }

Aspx 网格代码

 <telerik:RadGrid ID="RadGrid" runat="server" AllowPaging="True" AllowSorting="True"
                        GridLines="None" ShowGroupPanel="True" Skin="Black" AutoGenerateColumns="False"
                        Width="100%" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" PagerStyle-Mode="NumericPages"
                        OnItemInserted="GridItemInserted"
                        onitemdatabound="GridItemDataBound">
.............................................
........................................
..................................................
                            <ClientSettings>
                            <Selecting AllowRowSelect="true" />
                            <ClientEvents OnRowDblClick="RowDblClick" />
                        </ClientSettings>
</telerik:RadGrid>
<asp:Button ID="AddSrcButton" runat="server" Text="Add New" OnClientClick="return ShowInsertForm();" />

我的实际问题是根据用户权限禁用或启用 RowDblClick 属性 这是我在 aspx.cs 文件中的示例代码,我想在其中设置 radgrid 的编辑或查看权限

this.AddSrcButton.Enabled = this.Privilige.CanModify;//the value will be true or false
 this.RadGrid.Enabled=this.Privilige.CanModify; 

//该值将为 true 或 false ,基于此值我想启用/禁用我的 rowdblclick,任何人都可以提供帮助找出我哪里做错了

I have the following code

Javascript

function RowDblClick(sender, eventArgs)
                             {
                                window.radopen("SourceFileAdmin.aspx?SourceSystemFileId=" + eventArgs.getDataKeyValue("SourceSystemFileId"), "UserListDialog");
                            }

Aspx Grid Code

 <telerik:RadGrid ID="RadGrid" runat="server" AllowPaging="True" AllowSorting="True"
                        GridLines="None" ShowGroupPanel="True" Skin="Black" AutoGenerateColumns="False"
                        Width="100%" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" PagerStyle-Mode="NumericPages"
                        OnItemInserted="GridItemInserted"
                        onitemdatabound="GridItemDataBound">
.............................................
........................................
..................................................
                            <ClientSettings>
                            <Selecting AllowRowSelect="true" />
                            <ClientEvents OnRowDblClick="RowDblClick" />
                        </ClientSettings>
</telerik:RadGrid>
<asp:Button ID="AddSrcButton" runat="server" Text="Add New" OnClientClick="return ShowInsertForm();" />

My actual question is to disable or enable RowDblClick property based on the user permission
This is my sample code in the aspx.cs file where i want to set the edit or view permission for radgrid

this.AddSrcButton.Enabled = this.Privilige.CanModify;//the value will be true or false
 this.RadGrid.Enabled=this.Privilige.CanModify; 

//the value will be true or false ,based on this value i want to enable/disable my rowdblclick,can any one help out to figure out where i am doinfg wrong

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

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

发布评论

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

评论(1

停顿的约定 2024-12-04 09:15:23

您可以通过编程方式在服务器端设置行双击,

if(!this.Privilige.CanModify)
    RadGrid.ClientSettings.ClientEvents.OnRowDblClick = "";

但要注意,要重新启用页面,您可能需要全部刷新才能再次加载客户端 JavaScript,除非您将其移至 .cs 文件中

You can set the row double click on the server side programatically

if(!this.Privilige.CanModify)
    RadGrid.ClientSettings.ClientEvents.OnRowDblClick = "";

Beware though to renable the page you will probably need to refresh it all to get the clientside javascript to be loaded again, unless you move that into the .cs file

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