Hi Harry,
Thank you for your patience.
1) Avoid duplicate values in ComboBox Cell type:
To avoid duplicate values in the combo box cell type, first we need to create a datatable in which the duplicate values are eliminated and that data table has to be assigned as Datasource of the combo box cell. Please find the code snippet that illustrates this:
Protected Function CreateUniqueEntries(ByVal dv As DataView, ByVal colName As String) As DataTable
Dim dr As DataRow
Dim dt As DataTable = dv.Table.Clone()
dv.Sort = colName & " ASC"
Dim s As String = ""
For i As Integer = 0 To dv.Count - 1
If s.ToUpper() <> dv(i).Row(colName).ToString().ToUpper() Then
s = dv(i).Row(colName).ToString()
dr = dt.NewRow()
dr.ItemArray = dv(i).Row.ItemArray
dt.Rows.Add(dr)
End If
Next i
Return dt
End Function
Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridTableControlCurrentCellShowingDropDownEventArgs)
Dim cr As GridComboBoxCellRenderer = TryCast(e.TableControl.CurrentCell.Renderer, GridComboBoxCellRenderer)
Dim filterBar As GridFilterBar = New GridFilterBar()
Dim ColumnName As String = cr.CurrentStyle.DisplayMember
Dim dt As DataTable = TryCast(cr.ListBoxPart.DataSource, DataTable)
cr.ListBoxPart.DataSource = CreateUniqueEntries(dt.DefaultView, ColumnName)
End Sub
Please find the simple sample that illustrates this in the following link:
http://websamples.syncfusion.com/samples/Grid.Windows/F71498_Combo/main.htm2) Using RejectChanges() when deleting records in child table:
ds.RejectChanges(), rollbacks the deletion of records in ChildTable also. But since the GridGroupingControl is not getting refreshed properly, we couldnt view it. To reflect the changes done in the dataset, we need to rebind the datasource as follows:
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
If ds.HasChanges(DataRowState.Deleted) Then
ds.RejectChanges()
End If
Me.gridGroupingControl1.SuspendLayout()
Me.gridGroupingControl1.ResetTableDescriptor()
Me.gridGroupingControl1.TableDescriptor.Relations.Reset()
Me.gridGroupingControl1.DataSource = Nothing
Me.gridGroupingControl1.DataMember = Nothing
Me.gridGroupingControl1.DataSource = parentTable
Me.gridGroupingControl1.ResumeLayout(True)
End Sub
Please let me know if any concerns.
Regards,
Fathima