Two gridviews within a gridcontrol - Cannot get focused row handle for the inner grid
Using DevExpress 10.2 within Visual Studio 2008 with VB.Net I have created a single gridcontrol that contains two different gridviews. The gridviews are related using an id
column. Basically if there are related details about a row in the first gridview then the user can click on the plus sign to see all the related details. When I have any row on the first gridview I am开发者_如何转开发 able to get the focused row. Yet when I have the focus on any of the rows in the second gridview I am unable to get the focused row or the content of the row.
gridview2.focusedRowHandle = -2147...
gridview2.getRowCellValue(gridview2.FocusedRowHandle, "id") = Nothing
gridview2.GetFocusedRowCellValue("id") = Nothing
Is there any way to get the value in id
from the focused inner gridview? Or at least figure out the parent row and grab the id
value from there?
The code you are using is wrong because the DetailViews are separate objects, CLONEs of the detail GridView object assigned to a level. So, to make the code work, you should use
Dim detailRowHandle as integer = CType(gridControl1.FocusedView, ColumnView).FocusedRowHandle
For more details, please refer to the What can cause the properties, methods, and events of a detail grid view to fail?
精彩评论