I use the following code to group and format the group name.
Private Sub grdURLs2_GroupSummaryEvaluate(sender As Object, e As GroupSummaryEvaluationEventArgs) Handles grdURLs2.GroupSummaryEvaluate
Try
Dim groupRow As GridViewGroupRowInfo = TryCast(e.Context, GridViewGroupRowInfo)
If e.SummaryItem.Name = "col1" Then
If groupRow IsNot Nothing Then
If e.Value IsNot Nothing Then
e.FormatString = e.Value
Else
e.FormatString = ""
End If
End If
End If
Catch ex As Exception
txtError.Text = ex.Message & " - " & Format(Now, "HH:mm:ss")
End Try
End Sub
Everything works fine until I leave the group field empty. This code works fine with an empty field, but after restarting the program, it adds records with empty fields not to the same group, but creates a new one. After restarting the program, all fields are in the same group. What am I doing wrong and how can I do it right? Thank you!
P.S.: I figured out why this happens.
Then another question arises. How to check cells for empty values when adding a record and not add records with empty cells (continue editing)? Or replace empty values in cells with significant ones and add?