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

Determining current element

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.

3 Replies

SS Steve Smith July 18, 2005 04:38 PM

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.


AD Administrator Syncfusion Team July 19, 2005 03:54 AM

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); }


SS Steve Smith July 19, 2005 03:12 PM

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); >} >

Loader.
Live Chat Icon For mobile
Up arrow icon