I have two columns in a Grid. The 1st column of type image and a second column of text that represents the image of the first column. I wish when I group the first column of the grouping is done by hidden column. There is how to do?
I'll talk about that situation a lot of work. I managed to solve more Thank you Mike
The solution I like:
If e.Row.Column.Index = 1 Then If e.Row.Rows(0).IsGroupByRow = False Then If e.Row.Rows.Count = 1 Then e.Row.Description = "Situação : " & e.Row.Rows(0).Cells("Status").Text & " (" & e.Row.Rows.Count & " Item)" ElseIf e.Row.Rows.Count >= 2 Then e.Row.Description = "Situação : " & e.Row.Rows(0).Cells("Status").Text & " (" & e.Row.Rows.Count & " Itens)" End If Else For Each rowPrincipal As UltraGridRow In e.Row.Rows If rowPrincipal.IsGroupByRow = True Then Dim row As UltraGridRow row = rowPrincipal.GetChild(ChildRow.First) e.Row.Description = "Situação : " & row.Cells("Status").Text & " (" & e.Row.Rows.Count & " Itens)" End If Next End If End If
Hi,
You will only be able to get the value of the hidden column from a data row, not from a GroupByRow. So if you can have multiple levels of grouping, you will have to walk down to a level that is not grouped.
So you can check e.Row.Rows[0].IsGroupByRow. If it is a GroupByRow, then you will have to cast it to a GroupByRow and check if it's first child row is a GroupByRow. Keep walking down the chain until you get to a row that is NOT a GroupByRow and then you should be able to access the value of the hidden column.
Run in a way. In the event InitializeGroupByRow When I group any of the columns in the 1st time ever works. More when I go to group the 2nd column gives error. I've tried several ways to do this does not happen anymore I did not find any.
I did not meet the GroupByRow in InitializeGroupByRow
If e.Row.Column.Key = "Icon" Then If e.Row.Rows.Count = 1 Then e.Row.Description = "Status : " & e.Row.Rows.Item(0).Cells("Status").Text & " (" & e.Row.Rows.Count & " Item)" ElseIf e.Row.Rows.Count >= 2 Then e.Row.Description = "Status : " & e.Row.Rows.Item(0).Cells("Status").Text & " (" & e.Row.Rows.Count & " Itens)" End IfEnd If
There are a couple of way to do this.
One way would be to use handle the InitializeGroupByRow event. This event passes you the GroupByRow, so you won't be able to get the Value of the hidden column directly, since the GroupByRow has no columns.
What you have to do is get the child rows to get to the columns. So you can use the Rows collection on the GroupByRow to get it's child rows. If there's only one level of grouping, then this is very easy and you can just use the first row (e.GroupByRow.Rows[0]). You can then get the value from the hidden cell in that row.
A second option would be to use a GroupByEvaluator in addition to (or in place or) the SortComparer. The GroupByEvaluator allows you to essentially override the "Value" of the cell for the purposes of grouping. So you would return the hidden cell's value instead of the actual cell value. This would make it easier to get the hidden cell value from the GroupByRow, because the value would be returned directly from the Value property of the GroupByRow.
The Problem of the column title I managed to solve. Thanks for your patience Mike Now the other issue is still a big problem. Look. I compared the image column to another hidden column to the grouping to work. I need the property description of the event InitializeGroupByRow assume the value of the hidden column.