1

我正在尝试将 RadComboBox 添加到表格行单元格。我不能使用 table.row.cells.add(radcombobox) 因为它需要一个单元格对象。该表是以编程方式创建的。

protected override void Page_Init(object sender, EventArgs e) {
        base.Page_Init(sender, e);
        ConfigureTableColumns(DataContext, OperatingConditionsTable, node, segments);
        ConfigureTableRows(DataContext, OperatingConditionsTable, node, segments, inputs);
    }
private void ConfigureTableRows(CtalaDataContext context, Table table, Ctala.Entity.TreeNode reviewNode, IEnumerable<Ctala.Entity.TreeNode> segments, ILookup<string, OperatingConditionInput> inputsGroupedByCategory) {

        foreach (var category in inputsGroupedByCategory) {

            foreach (var input in category) {
                var row = new TableRow() {
                    CssClass = (altRow) ? "rgAltRow" : "rgRow"
                };
                table.Rows.Add(row);

                    var cell = new TableCell() {
                    Text = input.Name
                };
                row.Cells.Add(cell);

                var unitCell = new RadComboBox()
                {
                    ID = "Unit",
                    AllowCustomText = false
                };
                foreach (var item in input.Unit)
                {
                    unitCell.Items.AddRange(new RadComboBoxItem[] { new RadComboBoxItem(item) });
                }

                //cell = new TableCell()
                //{
                //    Text = input.Unit
                //};
                row.Controls.Add(unitCell);}}
4

1 回答 1

0

请参阅此链接

要将 RadComboBox 添加到您的单元格:

RadComboBox comboBox = new RadComboBox
{
    ID = "Foo"
}

comboBox.Items.Add(new RadComboBoxItem((0).ToString(), "FirstItem"));

newCell.Controls.Add(comboBox);
于 2013-04-01T21:40:38.760 回答