我有两个在表单加载过程中试图设置所选索引的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可以在后台代码中设置/更改组合框值吗?
发布于 2016-07-17 03:21:13
您应该设置网格单元格的值。您可以在网格的InitializeRow事件中这样做:
Private Sub grdUserAccounts_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles grdUserAccounts.InitializeRow
e.Row.Cells(accountCategoryId).Value = "Main"
End Sub我已经测试过了,它在我这一边工作。
https://stackoverflow.com/questions/38401525
复制相似问题