This is a migrated thread and some comments may be shown as answers.

Disable RadGrid on DoubleClick Row

1 Answer 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 08 May 2014, 07:40 PM
Hi

I have created a RadGrid and a RadButton.
For the RadGrid, I have attached a javascript:

            var script = @"
function RowDblClick(sender, eventArgs) {
$find(""" + btnEdit..ClientID + @""").click();
}";
            var javaScript = new HtmlGenericControl("script");
            javaScript.Attributes["type"] = "text/javascript";
            javaScript.InnerHtml = script;
            Controls.Add(javaScript);

            this.DataGrid.ClientSettings.ClientEvents.OnRowDblClick = "RowDblClick";

For the btnEdit (this is my RadButton), I have attached a EventHandler on the Serverside, which should deactivate the RadGrid:

            this.btnEdit.AutoPostBack = true;
            this.btnEdit.Click += BtnEditOnClick;

        private void BtnEditOnClick(object sender, EventArgs eventArgs) {
                this.DataGrid.Enabled = false;
                this.DataGrid.ClientSettings.EnablePostBackOnRowClick = false;
                this.DataGrid.ClientSettings.Resizing.AllowColumnResize = false;
                this.DataGrid.ClientSettings.Selecting.AllowRowSelect = false;
                this.DataGrid.ClientSettings.AllowKeyboardNavigation = false;
        }

But it doesn't work. When I click on the Button, it work great - but not when I doubleclick the row. But the javascript RowDblClick will be executed - I have checked this with an alert().

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 13 May 2014, 11:28 AM
Hello Thomas,

The behavior that you are describing could be observed if you are setting the EnablePostBackOnRowClick property to true in your grid settings. If that is the case, please have in mind that this will prevent the double-click event to be fired, because a postback will occur when you click on a row.

The only possible solution for such requirement would be to set the EnablePostBackOnRowClick property to false and use some custom logic (including setTimeout()) to fire command through the MasterTableView for handling the row click. When you set a proper timeout you will be able to handle the OnRowDblClick event of the grid and determine whether or not to cancel the firing of the command through the MasterTableView.

Hope that helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or