User (Old forums)MemberNovember 7, 2003 at 5:35 pmPost count: 23064
We’re using the grid as a search/lookup tool, and need to give the user the ability to double-click a row and have the row be selected as input into the parent form.
we’re trying to use:
but it isn’t working, all other uses of the grid seem to point at manipulating data in the grid, not selecting a row for use elsewhere.
any help would be greatly appreciated.
Imported from legacy forums. Posted by ghartt (had 4159 views)User (Old forums)MemberNovember 13, 2003 at 11:22 amPost count: 23064
1. Registering for the double-click event:
– capture the AddingRow-event (I think it’s AddingRow…) of the grid
– in the row-addition method, capture the DoubleClick-event of the added row
2. Retrieve the double-clicked row:
– in the double-click method, I think the <i>sender</i>-parameter is the row that was double-clicked (haven’t tried yet).
– if <i>sender</i> is not the row, just use the grid.CurrentRow, which should be the row that was double-clicked.
Imported from legacy forums. Posted by Tommy (had 309 views)User (Old forums)MemberNovember 13, 2003 at 11:29 amPost count: 23064
I just realized I made a mistake: in 1, you have to capture the DoubleClick-event of <b>each cell</b> of the added row (for-loop over <b>Cells</b>-property). In 2, the <i>sender</i>-parameter is the cell that was double-clicked: just cast it to a <b>Cell</b>, and get the <b>ParentRow</b>-property to get the row. Sorry for the mistake.
Imported from legacy forums. Posted by Tommy (had 229 views)User (Old forums)MemberMarch 23, 2005 at 2:08 pmPost count: 23064
an example would be alot better
Imported from legacy forums. Posted by narf03 (had 404 views)User (Old forums)MemberMarch 24, 2005 at 3:17 amPost count: 23064
Here’s an (untested) example, in C#:<code>EventHandler handler = new EventHandler(myGrid_CellDoubleClick);
foreach(Cell cell in myGrid.DataRowTemplate.Cells)
cell.DoubleClick += handler;
private void myGrid_CellDoubleClick(object sender, EventArgs e)
Cell cell = sender as Cell;
DataRow row = cell.ParentRow as DataRow;
Imported from legacy forums. Posted by Tommy (had 4862 views)
- You must be logged in to reply to this topic.