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.

GridControl - data binding cells to custom classes

Thread ID:

Created:

Updated:

Platform:

Replies:

31348 Jul 6,2005 12:06 AM Jan 4,2011 08:03 AM Windows Forms 4
loading
Tags: GridControl
Adam K.
Asked On July 6, 2005 12:06 AM

Are there any examples of binding cells to user defined classes for the GridControl? thanks, ak

Administrator [Syncfusion]
Replied On July 6, 2005 04:25 AM

One way that abitrary binding can be accomplished is by using the QuerycellInfo and SaveCellInfo events. In QueryCellInfo, if e.RowIndex and e.ColIndex point to your custom cell, then set e.Style.CellValue to be what you want it to be from your custom class ffrom that cell. You can set it to be some object, and the grid would display the object.ToString text in the cell. If you are trying to edit your custom object in the grid, in SaveCellInfo, if e.RowIndex and e.ColIndex point to your custom cell, then take the text from e.Style.Text and use it to modify your class object. Also set e.Handled = true so the grid does not to further process your object.

Adam K.
Replied On July 6, 2005 09:02 AM

do you have any example of this anywhere on the site? >One way that abitrary binding can be accomplished is by using the QuerycellInfo and SaveCellInfo events. > >In QueryCellInfo, if e.RowIndex and e.ColIndex point to your custom cell, then set e.Style.CellValue to be what you want it to be from your custom class ffrom that cell. You can set it to be some object, and the grid would display the object.ToString text in the cell. > >If you are trying to edit your custom object in the grid, in SaveCellInfo, if e.RowIndex and e.ColIndex point to your custom cell, then take the text from e.Style.Text and use it to modify your class object. Also set e.Handled = true so the grid does not to further process your object.

Administrator [Syncfusion]
Replied On July 6, 2005 10:16 AM

In this sample, cell 2,2 holds custom object. If you type T=Something you should see the cell display Something. If you type C=blue you shoul dsee teh cell turn blue. http://www.syncfusion.com/Support/user/uploads/GC_CustomObject_4549b667.zip

John Bowlin Bosco K [Syncfusion]
Replied On January 4, 2011 08:03 AM

Hi Nethanel,

Thank you very much for your update.

Currently In Essential XlsIO, we don’t have any methods to reflect the changes made in the Grid control. As a workaround, explicitly you can raise an event to export the Grid content to the Excel sheet when the Grid was modified . We have created a sample to update the data, please try the sample and let me know if this helps you.

Please let me know if you need any clarifications.

Thanks,
Pauline Bosco.




GridToExcel_2d70890.zip

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.

;