We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change cell background colour when GridListControl value changes.

Hi,
I have a column which is of cell type "GridListControl" in a GridDataboundGrid. I would like to be able to change the background of the cell when the value of the GridListControl changes as soon as the dropdown closes rather than when the cell being eidted loses focus. Is this possible?

Thanks

1 Reply

MS Maniratheenam Sehar Syncfusion Team October 2, 2014 06:54 PM UTC

Hi Martin Fenech,

Thank you for using Syncfusion products.

We would like to let you know that we can use the CurrentCell property to get the rowIndex and columnIndex of the current cell. Having the rowIndex and columnIndex we can set the backcolor of the selected cell. For changing the back colour of the combobox we suggest you to use the CurrentCellShowingDropDown event. Please refer the below code snippet.

C#:

this.grid1.Click+=new EventHandler(grid1_Click);

void grid1_Click(object sender, EventArgs e)

{

GridCurrentCell cc = this.grid1.CurrentCell;

grid1[cc.RowIndex, cc.ColIndex].BackColor = Color.Black;

}

this.grid1.CurrentCellShowingDropDown+=new GridCurrentCellShowingDropDownEventHandler(grid1_CurrentCellShowingDropDown);

void grid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs arg)

{

GridCurrentCell cc = this.grid1.CurrentCell;

GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;

cr.ListBoxPart.BackColor = Color.Blue;

cr.ListBoxPart.ForeColor = Color.Cyan;

}

Please let us know if you need any further assistance

Regards,

ManiRatheenam S

 


Loader.
Up arrow icon