2016-07-15 69 views
1

私はそうのようなのUltraGrid EditorComponentにバインドされているフォームのロード時に選択したインデックスをオンに設定しようとしています2つの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

グリッドのセルの値を設定する必要があります。グリッドのInitializeRowイベントでこれを行うことができます:

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

私はこれをテストして私の側で動作します。

関連する問題