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

cell double click to open a new form

1 Answer 244 Views
GridView
This is a migrated thread and some comments may be shown as answers.
AJing
Top achievements
Rank 1
AJing asked on 24 Nov 2011, 08:02 AM
Hi:
   How to open a new form when cell-double click in RadGridViwe?
   It seems that it only fires if the cells column is readonly.,but if the cell in editmode ,the cell-double click does not occur  .

  My user want to:
  1. Cell is put into editmode when cell-double click
  2. Cell is put into focus when cellclick
  3. User can edit cell or open a new form when cell-double click.

  We use 2011Q2 official version

Greetings
Look forward to you
AJing.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Nov 2011, 10:36 AM
Hi Ajing,

Thank you for writing.

I am getting straight to your questions.

1. This is the default behavior of the grid, when not in edit mode. When clicked a cell with the first click it will become current cell and with the second click it will get into edit mode.

2. This is the default behavior of the grid, when you click a cell it it set as current, keeping its previous state - in edit mode or not.

3. The CellDoubleClick event will get fired if RadGridView is not in edit mode. If the cell is in edit mode, you will have to subscribe to the DoubleClick event of the editor of the edited cell. For example for text box editor, you have to subscribe to the DoubleClick event of the hosted text box:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
    if (editor != null)
    {
        RadTextBoxEditorElement element = editor.EditorElement as RadTextBoxEditorElement;
        element.TextBoxItem.HostedControl.DoubleClick += new EventHandler(HostedControl_DoubleClick);
    }
 
}
 
void HostedControl_DoubleClick(object sender, EventArgs e)
{
    //do something
}

I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
 
Regards,
Stefan
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
GridView
Asked by
AJing
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or