开发者

How to enable/disable the row double click editing property of radgrid based on condition

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 asp开发者_运维问答x.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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜