Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
How to add dynamically created combobox on CellClickEvent of Ultrawingrid
posted

Hi, I have an edit button in my grid, on click of which i want to change one grid cell of selected row to combobox.

I have written below code for the same in CellClickEvent of the grid:-

string action = e.Cell.Value.ToString();

if (action == "Edit")

 {

 e.Cell.Value = "Update";

 UltraCombo ultraComboPanel = new UltraCombo();

ultraComboPanel.DataSource = _columnsList;

//assig  combobox to the grid cell

}

But i do not know how to assign combobox to that grid cell. Is my approach correct?

Parents
No Data
Reply
  • 180
    posted

    Hi, I am using ValueList now and am able to show dropdown in a single cell of grid as below:-

    // declare ValueList and assign items to it

    private ValueList _columnList = new ValueList();

     

    //Grid Cell Click Event

    if(e.Cell.Value=="Edit")

    {

    e.Cell.Value="Update";

    e.Cell.Row.Cells["ColumnName"].ValueList = _columnList;

    }

    else if (e.Cell.Value == "Update")

    {

    string selectedValue = _columnList.SelectedItem.ToString();

    //make db call to update latest value

    e.Cell.Value = "Edit";

    }

     

    BUT, here _columnList.SelectedItem is null. How to retrieve selectedText from ValueList which I have added in grid cell.

     

Children