HOW TO ADD RADCOMBOBOX TO CELL IN A TABLE ROW CELL

Goti Bandu

Total Post:119

Points:835
Posted by  Goti Bandu
 1422  View(s)
Ratings:
Rate this:

I am trying to add a RadComboBox to a table row Cell. I cannot use table.row.cells.add(radcombobox) as it expects a cell object. The table is programatically created .

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);}}

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: How to add radcombobox to cell in a table row cell

    Hi Goti, 


    To add a RadComboBox to your cell:

    RadComboBox comboBox = new RadComboBox

    {

        ID = "Foo"

    }

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

    newCell.Controls.Add(comboBox);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!