我希望将DotNetBar SuperDataGrid控件中的列呈现为comboBox (更准确地说,是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 SubMyComboBox类是这样的:
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在单元格中显示正确的值。绑定是正确的,如果将"ArticleID“呈现为”文章“,则每个值都是正确的。问题是,当值从ArticleID = 1 to ArticleID = 2 (No1=“文章No2")转移到SuperDataGrid = "Artcle No2”时,SuperDataGrid会进入某种形式的无限循环,并且值开始在1和2之间移动。如果有人能在这个问题上提供一些建议,我将不胜感激。附言:我还试过这个:
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"得到了同样的结果。
发布于 2013-02-27 03:18:49
{ArticleBindingSource,“文章”,"ArticleID"}当DisplayMember,ValueMember的值相同时,我认为这是错误的
https://stackoverflow.com/questions/14905127
复制相似问题