I want to render a column in the DotNetBar SuperDataGrid Controll as a comboBox (more precisely as a GridComboBoxExEditControl
) .
The SuperDataGrid
is connected to a binding source.
In the DataBindingComplete
Event I have the following:
Private Sub SuperGrid_DataBindingComplete(ByVal sender As Object, ByVal e As DevComponents.DotNetBar.SuperGrid.GridDataBindingCompleteEventArgs) Handles SuperGrid.DataBindingComplete
Dim panel As DevComponents.DotNetBar.SuperGrid.GridPanel
panel = e.GridPanel
panel.Columns("ArticleID").RenderType = GetType(MyComboBox)
panel.Columns("ArticleID").RenderParams = New Object() {ArticleBindingSource, "Article", "Article"}
End Sub
And the MyComboBox class goes:
Public Class MyComboBox
Inherits GridComboBoxExEditControl
Public Sub New(ByVal Bind As BindingSource, ByVal disp As String, ByVal val As String)
DataSource = Bind
DisplayMember = disp
ValueMember = val
End Sub
End Class
This results in the the following:
The SuperDataGrid Shows the correct Values in the cells. The binding is correct and every value of "ArticleID" if rendered as "Article".
The problem is that when the value shifts From ArticleID = 1 to ArticleID = 2
(Article = "Article No1" to Article = "Artcle No2") the SuperDataGrid goes in some form of endless loop and the value start shifting between 1 and 2. Am I doing something wrong?
If anyone can offer some advice on this subject I will be very grateful.
P.S.
I also tried this:
panel.Columns("ArticleID").EditorType = GetType(GridComboBoxExEditControl)
Dim art As GridComboBoxExEditControl = DirectCast(panel.Columns("ArticleID").EditControl, GridComboBoxExEditControl)
art.DataSource = ArticleBindingSource
art.DisplayMember = "Article"
art.ValueMember = "ArticleID"
Got the same result.