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

Disable RadGrid on DoubleClick Row

1 Answer 9 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:45 PM
Hi

I create a RadGrid and a RadButton by code.
The RadButton is deactivating my RadGrid:

            this.editButton = new RadButton();
            this.editButton.Visible = false;
            this.editButton.AutoPostBack = true;
            this.editButton.Click += EditButtonOnClick;

        private void EditButtonOnClick(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;
        }

This is working great.
But now, I have also to deactivate the RadGrid at doubleclick on a row. For this, I have created a javascript for OnRowDblClick for the RadGrid:

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

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

The RowDblClick will be executed on DoubleClick - I have checked this with a alert(). But the Click-Eventhandler of the EditButton on the Serverside will not be executed. Can someone help me please how I can do this? - Thanks.

Thomas

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 09 May 2014, 04:42 AM
Hi Thomas,

Please try the following JavaScript to call the onClick event of RadButton in OnRowDblClick event of RadGrid.

JavaScript:
function OnRowDblClick() {
    var button = $find("<%=EditButton.ClientID %>");
    button.click();
}

Thanks,
Shinu.
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or