2016-07-15 65 views
1

我有我试图绑定到的UltraGrid EditorComponent像这样的形式加载过程中设置所选指数在两个UltraCombo项目...设置UltraCombo选择指数时,与其绑定的UltraGrid EditorComponent

With grdUserAccounts.DisplayLayout.Bands(0)  
    For x = 0 To .Columns.Count - 1 
     Select Case .Columns(x).Key 
      Case accountCategoryId 
       .Columns(x).Header.Caption = "Category" 
       .Columns(x).Width = 90 
       .Columns(x).Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Center 
       .Columns(x).Header.VisiblePosition = 0 
       .Columns(x).CellActivation = Activation.AllowEdit 
       .Columns(x).EditorComponent = cboAccountCategory 
       .Columns(x).Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList 
      Case accountTypeId 
       .Columns(x).Header.Caption = "Type" 
       .Columns(x).Width = 90 
       .Columns(x).Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Center 
       .Columns(x).Header.VisiblePosition = 1 
       .Columns(x).CellActivation = Activation.AllowEdit 
       .Columns(x).EditorComponent = cboAccountType 
       .Columns(x).Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList 
     End Select 
    Next 
End With 

我已经尝试设置单元格的值,当一个新行被添加,但没有奏效。

e.Cell.Row.Cells(x).Value = "Main" 

我也尝试设置组合框的值,并没有奏效。

cboAccountCategory.Value = 1 

是否可以在后面的代码中设置/更改组合框值?

回答

0

您应该设置网格的单元格的值。你可以在Grid的InitializeRow事件中这样做:

Private Sub grdUserAccounts_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles grdUserAccounts.InitializeRow 
    e.Row.Cells(accountCategoryId).Value = "Main" 
End Sub 

我已经测试过这个,它在我身边工作。