We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How i can capture specific cell double click

How i can capture specific cell double click

in sysncfusion.grid.groupig.cotrol

9 Replies

HA haneefm Syncfusion Team April 23, 2007 04:48 PM UTC

Hi Ashok,

You can try handling the TableControlCurrentCellControlDoubleClick event for getting the mouse double in cell. It is only fires when the cell is in edit mode. Here is a code.

this.gridGroupingControl1.TableControlCurrentCellControlDoubleClick += new GridTableControlControlEventHandler(gridGroupingControl1_TableControlCurrentCellControlDoubleClick);

void gridGroupingControl1_TableControlCurrentCellControlDoubleClick(object sender, GridTableControlControlEventArgs e)
{
Console.WriteLine("For getting the Double in Current cell edit Mode");
}

For non edit mode , you cen get the the mouse double in cell using TableControlCellDoubleClick event.

this.gridGroupingControl1.TableControlCellDoubleClick += new GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCellDoubleClick);

void gridGroupingControl1_TableControlCellDoubleClick(object sender, GridTableControlCellClickEventArgs e)
{
Console.WriteLine("For Non- Edit Mode");
}

Best regards,
Haneef


CH Chinedu May 30, 2007 05:47 PM UTC

Thanks again Haneef,

How do I capture the value of a particular column in the row doubleclicked.

Each row has an ID column, when the row is doubleclicked, I want to get the Id value for that row.


CH Chinedu May 30, 2007 06:49 PM UTC

Found it, used this method....

int RowIndex = e.TableControl.CurrentCell.RowIndex;
int ColIndex = 1;

Id = e.TableControl.Table.TableModel[RowIndex, ColIndex].CellValue.ToString()

Thanks for your help


HA haneefm Syncfusion Team May 30, 2007 07:02 PM UTC

Hi Nedu,

You can try these code.

int RowIndex = e.TableControl.CurrentCell.RowIndex;
int ColIndex = e.TableControl.CurrentCell.ColIndex;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(RowIndex,ColIndex);
string id = style.CellValue.ToString();

Best regards,
Haneef


CH Chinedu June 1, 2007 02:07 PM UTC

Thanks Haneef,

what if the column has been moved by the user at runtime, please show how I can get to a named column at runtime.


HA haneefm Syncfusion Team June 1, 2007 03:17 PM UTC

Hi Nedu,

You can get the draged column name using the e.Column property from GridQueryAllowDragColumnEventArgs in TableControlQueryAllowDragColumn event. Below is a code snippet

private void gridGroupingControl1_TableControlQueryAllowDragColumn(object sender, GridQueryAllowDragColumnEventArgs e)
{
Console.WriteLine( e.Column );
}

Best regards,
Haneef


CH Chinedu June 3, 2007 03:43 PM UTC

Hey Haneef, Thanks for your help and time.

I believe you misunderstood my question.

I was asking about a situation where the columns have been moved around by the user. The ID_col column used to be column 1 and the user has moved it to position 9 or 10 or 20 in the grid.

now the user double-clicks a row. I want to be able to find the ID value held by the ID_col for that particular row whose cell was double clicked, The ID_col could now be at position 9 or 10 or 20 etc.


HA haneefm Syncfusion Team June 4, 2007 09:52 PM UTC

Hi Nedu,

Sorry for the inconvenience caused. If you want to get the column value in a record, then you need to use the record.GetValue() method. Below is a code snippet that show this task.

int RowIndex = e.TableControl.CurrentCell.RowIndex;
int ColIndex = e.TableControl.CurrentCell.ColIndex;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(RowIndex,ColIndex);

if( style != null && style.TableCellIndentity != null
&& style.TableCellIndentity.DisplayElement != null )
{
Record rec = style.TableCellIndentity.DisplayElement.GetRecord();
if( rec != null )
object obj = rec.GetValue("ID_col");
}

You can also get the underlying DataRow when you call record.GetData(). That will return the DataRowView element for the record.

Best regards,
Haneef


CH Chinedu June 6, 2007 02:54 PM UTC

Thanks a million Haneef.

Loader.
Live Chat Icon For mobile
Up arrow icon