0

我想将 DotNetBar SuperDataGrid Controll 中的一列呈现为一个组合框(更准确地说是一个GridComboBoxExEditControl)。SuperDataGrid连接到绑定源。在DataBindingComplete事件中,我有以下内容:

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

MyComboBox 类如下:

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

这将导致以下结果: SuperDataGrid 在单元格中显示正确的值。如果呈现为“Article”,绑定是正确的,并且“ArticleID”的每个值。问题是当值从ArticleID = 1 to ArticleID = 2 (Article = "Article No1" 到 Article = "Artcle No2") 时,SuperDataGrid 会进入某种形式的无限循环,并且值开始在 1 和 2 之间移动。我做错了什么吗?如果有人能就这个问题提供一些建议,我将不胜感激。PS我也试过这个:

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"

得到了同样的结果。

4

1 回答 1

1

{ArticleBindingSource, "Article", "ArticleID"} 我认为 DisplayMember 和 ValueMember 的值相同时不正确

于 2013-02-26T19:18:49.493 回答