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
close icon

Button in derived GridTextBoxCellRenderer

Hi,

I'd like to derive GridTextBoxCellRenderer and add a button to the cell for my own purposes.

I derived the renderer like this:

public class MyGridTextBoxCellRenderer : GridTextBoxCellRenderer {
public MyGridTextBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
: base(grid, cellModel) {
DropDownPart = new GridDropDownCellImp(this);
DropDownButton = new GridCellButton(this);
}
}

This does not work (Grid shows red cell with 'Exception' text on it). Code works only if I derive after GridDropDownCellRenderer, but I'd like not to have a dropDown. I'd like to have a simple text with button only. How can I achieve this?

Thank you for your help.

Best regards,
Marek S

1 Reply

HA haneefm Syncfusion Team June 29, 2007 09:17 PM UTC

Hi Marek,

The attached sample demonstrates how you can implement a button edit control in grid cells. The ButtonEditCellButton class that is derived from the class GridCellButton, is used to draw buttons in grid cells. Inside this class, the ButtonEditStyleProperties class can be accessed in order to supply the necessary style settings for these button controls. This class will let you create different types of button controls like buttons with images, buttons painted with colors, button faces with text, buttons with borders, etc. It also provides many options like aligning the buttons in grid cells, aligning the text on the button face, etc. You can also enable or disable these button controls. Apart from these classes, this sample also includes a cell model and a cell renderer class which, can be used to create a custom cell type. In addition, this sample also has RTL support for these button edit cells.

Below is a sample.
ButtonEditCells.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon