首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在绑定到UltraCombo EditorComponent时设置UltraGrid选定索引

在绑定到UltraCombo EditorComponent时设置UltraGrid选定索引
EN

Stack Overflow用户
提问于 2016-07-16 00:58:29
回答 1查看 1.4K关注 0票数 1

我有两个在表单加载过程中试图设置所选索引的UltraCombo项,它们被绑定到UltraGrid EditorComponent,如下所示……

代码语言:javascript
复制
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

我曾尝试在添加新行时设置单元格值,但不起作用。

代码语言:javascript
复制
e.Cell.Row.Cells(x).Value = "Main"

我也尝试过设置组合框的值,但没有成功。

代码语言:javascript
复制
cboAccountCategory.Value = 1

可以在后台代码中设置/更改组合框值吗?

EN

回答 1

Stack Overflow用户

发布于 2016-07-17 03:21:13

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

代码语言:javascript
复制
Private Sub grdUserAccounts_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles grdUserAccounts.InitializeRow
    e.Row.Cells(accountCategoryId).Value = "Main"
End Sub

我已经测试过了,它在我这一边工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38401525

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档