I don't want to become a pest on this forum, but I'm tearing my hair out over a very simple task I want to perform with a data-bound grid.
Upon double-clicking either in a cell in a row or the row header column for that row, I want to capture that event, get the value entered in the first column of that row and run some code based on this value.
I got this to work in a round-about way using the GridDoubleClick event, but at that point, to get the row index of the row double-clicked, I had to have clicked into a cell in the grid _before_ double-clicking on the row header.
Then I decided to try the CellDoubleClick event instead, but I can't even get this to fire at all.
So my two questions are this: how can you get the index of the row double-clicked if you have only clicked in the row header and not a cell in the row? And, how do you get the CellDoubleClick event to fire.
I thought that the latter might have to do with the grid being editable, but when I tried to set EnableEdit to false, I got a runtime error NullReferenceException on that line of code.
Phew. Any help greatly appreciated.
CBClay Burch Syncfusion Team September 20, 2002 08:53 AM
To get the index of the clicked column header in the grid's DoubleClick event, you can use code such as:
Dim pt As Point = GridDataBoundGrid1.PointToClient(Control.MousePosition)
Dim row, col As Integer
GridDataBoundGrid1.ViewLayout.PointToClientRowCol(pt, row, col, True)
col = col + GridDataBoundGrid1.LeftColIndex - 1 ' absolute col
In the 184.108.40.206, release the CellDoubleClick does not fire because of a coding error in the OnDoubleClick method. If you have access to the source, you can see that method is firing the click event instead of the DoubleClick event. This is corrected in the 220.127.116.11 release due out next week.