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.

Grid Button

Thread ID:

Created:

Updated:

Platform:

Replies:

36262 Oct 25,2005 07:39 AM Oct 25,2005 08:43 AM Windows Forms 3
loading
Tags: GridControl
Stephane Augusto
Asked On October 25, 2005 07:39 AM

Hello, I have a custom button (MyButton form GridCellButton). I want to have access dynamicly properties from MyButton. (MyButton)gridControl(row, col) is not ok !! How have an access to MyButton in the grid? Stéphane.

Administrator [Syncfusion]
Replied On October 25, 2005 08:14 AM

I am not sure how you are setting up the grid to use your button, but if you are doing something like the EllipsisText button in the DrawButtons sample, then you can add a public member to the renderer class and set it when you create the button. public EllipsisCellButton myButton; public EllipsisCellRenderer(GridControlBase grid, GridTextBoxCellModel cellModel) : base(grid, cellModel) { myButton = new EllipsisCellButton(this) AddButton(myButton); } Then when you want to get your button, you can get it through the renderer. EllipsisCellRenderer cr = this.gridControl1.CellRenderers["EllipsisText"] as EllipsisCellRenderer; // access the button through cr.myButton

Stephane Augusto
Replied On October 25, 2005 08:22 AM

yes, i have used the EllipsisText button in the drawButtons sample. with "EllipsisCellRenderer cr = this.gridControl1.CellRenderers["EllipsisText"] as EllipsisCellRenderer", i have not access to the EllipsisCellButton from each cell. i have use gridControl.getCelleRenderer(row, col). But it''s the same problem. >I am not sure how you are setting up the grid to use your button, but if you are doing something like the EllipsisText button in the DrawButtons sample, then you can add a public member to the renderer class and set it when you create the button. > >public EllipsisCellButton myButton; > >public EllipsisCellRenderer(GridControlBase grid, GridTextBoxCellModel cellModel) > : base(grid, cellModel) >{ > myButton = new EllipsisCellButton(this) > AddButton(myButton); >} > > > >Then when you want to get your button, you can get it through the renderer. > >EllipsisCellRenderer cr = this.gridControl1.CellRenderers["EllipsisText"] as EllipsisCellRenderer; >// access the button through cr.myButton > > >

Administrator [Syncfusion]
Replied On October 25, 2005 08:43 AM

>>i have not access to the EllipsisCellButton from each cell There is not a separate button for every cell. A single button is shared by all cells that use your celltype. If you have 50000000000 cells using your celltype, it would be very inefficient to have 5000000000 different buttons. What you need to do is to store the cell specific information you want to use in the style for the cell (you can use the style.Tag for instance). Then in your renderer class, you would move the information from the style to your button as needed. Usually, this is done in the OnInitialize override in the renderer class for the active cell.

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.

;