Hi all,
We have implemented a master-detail hierarchical grid. The cell.image property of certain cells in the master grid, and also in the detail grid, is assigned an image depending on the value of some other cell in the same row. Note that not all master records have a corresponding non empty detail grid. Some do, because there is data to display bebeath them, and some do not because there is not any data to display beneath them. The cellformating event is used to assign the corrresponding images to the current cell as follows:
Private Sub FFAViewGrid_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles FFAViewGrid.CellFormatting
If e.CellElement.ColumnIndex = 3 Then
Try
Select Case e.CellElement.RowInfo.Cells(5).Value
Case "3"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.UpTick_Green)
Case "2"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.Minus_Green)
Case "0"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.Minus_Red)
Case "1"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.DownTick_Red)
End Select
Catch
End Try
end if
end sub
Initially the grid is displayed in unexpanded mode as in this picture: view picture In htis example only the period columns labeled Q3-09 and Q4-09 have a non empty hierarchical child grid and have a value in cell(5) of the row to trigger the image property event. All other master rows have a zero value in cell(5) and hence they should not triger the image property event.
However, when you click to expand the master rows to see the detailed child grid for some reason randomly selected empty master rows are populated with cell images. This phenomenon repeats as many times as you expand and unexpand a master row, populating more random master rows with images when it should not. The picture of the undesired output can be viewed here: view picture and here: view picture
We have extensively tried to debug the cellformating event, only to notice that although the row index number was refering to an empty master row, one that does not have any value in e.CellElement.RowInfo.Cells(5).Value to trigger the code to display an image in cell(3), the value reported by the debuger for e.CellElement.RowInfo.Cells(5).Value was from another row and not from the one corresponding to the event.
We can only guess that this is a problem related to the fact that not all master records have a non empty detailed child grid. Do you have any other suggestions why is this behaviour caused and how it can be remedied?
Thank you in advance for your kind cooperation.
Regards,
George
We have implemented a master-detail hierarchical grid. The cell.image property of certain cells in the master grid, and also in the detail grid, is assigned an image depending on the value of some other cell in the same row. Note that not all master records have a corresponding non empty detail grid. Some do, because there is data to display bebeath them, and some do not because there is not any data to display beneath them. The cellformating event is used to assign the corrresponding images to the current cell as follows:
Private Sub FFAViewGrid_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles FFAViewGrid.CellFormatting
If e.CellElement.ColumnIndex = 3 Then
Try
Select Case e.CellElement.RowInfo.Cells(5).Value
Case "3"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.UpTick_Green)
Case "2"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.Minus_Green)
Case "0"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.Minus_Red)
Case "1"
e.CellElement.Image = FFAViewGrid.SmallImageList.Images(FFAViewIcons.DownTick_Red)
End Select
Catch
End Try
end if
end sub
Initially the grid is displayed in unexpanded mode as in this picture: view picture In htis example only the period columns labeled Q3-09 and Q4-09 have a non empty hierarchical child grid and have a value in cell(5) of the row to trigger the image property event. All other master rows have a zero value in cell(5) and hence they should not triger the image property event.
However, when you click to expand the master rows to see the detailed child grid for some reason randomly selected empty master rows are populated with cell images. This phenomenon repeats as many times as you expand and unexpand a master row, populating more random master rows with images when it should not. The picture of the undesired output can be viewed here: view picture and here: view picture
We have extensively tried to debug the cellformating event, only to notice that although the row index number was refering to an empty master row, one that does not have any value in e.CellElement.RowInfo.Cells(5).Value to trigger the code to display an image in cell(3), the value reported by the debuger for e.CellElement.RowInfo.Cells(5).Value was from another row and not from the one corresponding to the event.
We can only guess that this is a problem related to the fact that not all master records have a non empty detailed child grid. Do you have any other suggestions why is this behaviour caused and how it can be remedied?
Thank you in advance for your kind cooperation.
Regards,
George