ComboBox bind dynamic source based on another column value

Posted by: 1728884346 on 23 May 2018, 1:46 am EST

  • Posted 23 May 2018, 1:46 am EST

    Hi,
    i saw a example as below for winform, any example to achieve this function in web application for ASP.NET MVC?

    https://www.grapecity.com/en/blogs/how-to-assign-different-combobox-values-in-each-row-of-a-grid
  • Replied 24 May 2018, 1:04 am EST

    Hi,
    We are looking into this. We will update by tomorrow.

    ~Manish
  • Replied 24 May 2018, 11:07 pm EST

    Hi,
    We are sorry for the delayed response.
    Please refer to the following demo sample for the same using DataMap:
    http://demos.componentone.com/ASPNET/LearnMvcClient/C1FlexGrid/DynamicDataMapsCustomize

    ~Manish
  • Replied 29 May 2018, 6:28 pm EST

    Hi Manish,

    thanks, but i have problem when try to use dataMap, success to bind Text to dropdown, but how to get selectedValue ?

    or any way to bind a dynamic model for ComboBox? our original design is use ComboBox.
  • Marked as Answer

    Replied 31 May 2018, 7:17 pm EST

    Hi,
    We are sorry for the delayed response.
    The selectedValue can be get using FlexGrid cell value since DataMap set the cell value.

    However, if you would like to add ComboBox, you need to add ComboBox using ItemFormatter. Please refer to the following script code snippet to add ComboBox:

     function ItemFormatter(panel, r, c, cell) {
    if (panel.cellType == 1 && panel.columns[c].binding == "Country") {
    let div = document.createElement("Div");
    div.id = "div" + r + c;
    new wijmo.input.ComboBox(div, {
    itemsSource: panel.rows[r].dataItem.Countries,
    selectedValuePath: "Id",
    displayMemberPath:"Country",
    selectedIndexChanged: function (s, e) {
    panel.rows[r].dataItem.Country = s.selectedValue;
    console.log(panel.grid.getCellData(r, c));
    }
    });
    cell.innerText = "";
    cell.appendChild(div)
    }
    }


    ~Manish
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels