Determining current element

Thread ID:

Created:

Updated:

Platform:

Replies:

I''m trying to determine the current element from the TableControlCellClick event. The following line *should* give the the element that I click:
Console.WriteLine(e.TableControl.Table.CurrentElement.ToString)
However, I find it''s always one click behind. When I click on a new element, it shows the last one I clicked on. If I click a 2nd time, it shows the correct element. (I get the same behavior with TableControlCellMouseUp, too).
Any thoughts as to what I''m doing wrong?
Thanks!
Steve.

One thing I forgot to mention - when clicking on a record, the WriteLine entry is correct. The "goofy" behavior only happens when I click on a header.
Thx!
Steve.
>I''m trying to determine the current element from the TableControlCellClick event. The following line *should* give the the element that I click:
>Console.WriteLine(e.TableControl.Table.CurrentElement.ToString)
>
>However, I find it''s always one click behind. When I click on a new element, it shows the last one I clicked on. If I click a 2nd time, it shows the correct element. (I get the same behavior with TableControlCellMouseUp, too).
>
>Any thoughts as to what I''m doing wrong?
>
>Thanks!
>Steve.

I suspect the reason this is happening is that headers cannot get focus (and thus are not the current element).
If you want to get the element that was clicked (whether it is a header or record or ??), you can try this code.
private void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
Console.WriteLine(style.TableCellIdentity.DisplayElement);
}

That did the trick. Thanks loads!!
Steve
>I suspect the reason this is happening is that headers cannot get focus (and thus are not the current element).
>
>If you want to get the element that was clicked (whether it is a header or record or ??), you can try this code.
>
>private void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
>{
> GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
> Console.WriteLine(style.TableCellIdentity.DisplayElement);
>}
>