This is a migrated thread and some comments may be shown as answers.
How to enable or disable rowdouble click property of radgrid from serverside based on some condition
2 Answers 54 Views
This is a migrated thread and some comments may be shown as answers.
mahesh
Top achievements
Rank 1
mahesh asked on 02 Aug 2011, 12:57 PM
I have the following code

Javascript

    function RowDblClick(sender, eventArgs)
                                 {
                                    window.radopen("Example.aspx?Id=" + eventArgs.getDataKeyValue("Id"), "Dialog");
                                }

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="AddButton" runat="server" Text="Add New" OnClientClick="return ShowForm();" />

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.AddButton.Enabled =true/false;//the value will be true or false
     this.RadGrid.Enabled=true/false;

//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 doing wrong

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 02 Aug 2011, 01:32 PM
Hello Mahesh,

Try the following code snippet to disable RowDblClick from server side.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (Session["UserName"] == "Name")
   {
     RadGrid1.ClientSettings.ClientEvents.OnRowDblClick = "false";
   }
}

Thanks,
Princy.
0
Bruno
Top achievements
Rank 2
answered on 12 Sep 2011, 02:41 PM
I'm stumped. What happens when you set "false" to a property that accepts method name / delegate?
Sorry if this is a noob question, but can you please enlighten me?

Gracias :)
Tags
Grid
Asked by
mahesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Bruno
Top achievements
Rank 2
Share this question
or