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.
Unfortunately, activation email could not send to your email. Please try again.

Change cell background colour when GridListControl value changes.

Thread ID:

Created:

Updated:

Platform:

Replies:

117337 Sep 30,2014 08:39 AM Oct 2,2014 02:54 PM Windows Forms 1
loading
Tags: GridDataBoundGrid(Classic)
Martin Fenech
Asked On September 30, 2014 08:39 AM

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

Maniratheenam Sehar [Syncfusion]
Replied On October 2, 2014 02:54 PM

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

 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;