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.

GridGroupingControl Getting Records in Custom CellRenderer during Draw event

Thread ID:

Created:

Updated:

Platform:

Replies:

43679 Apr 28,2006 03:42 PM Apr 28,2006 05:56 PM Windows Forms 2
loading
Tags: GridControl
Eric Robishaw
Asked On April 28, 2006 03:42 PM

I have a custom CellModel and CellRenderer. The CellRenderer draws a special "graph" based on values from 3 columns in the each row. I pass the names of the columns into the constructor of the Model, which passes it to the constructor of the renderer. During the renderer''s Draw method, I cannot correctly get the record / data I need. I cannot find a GetRecord method of anything exposed to the Renderer, so I''m trying to use Grid.Model[rowIndex, x], where X is defined by: int x = grid.Model.NameToColIndex(columnName) This works, as long as the Visible Columns Collection hasn''t changed. However, if it has, then the data returned by this call is for the wrong columns. Bottom Line: How do I get to the correct record data during the renderer''s Draw method? There is no GetRecord() method available to the GridTableControl class that is returned by the base Grid class in the renderer. There is likewise, no GetRecord() method in the Grid.Model (of type GridTableModel) HOW DO I GET THE RECORD? Going Nuts. Eric

Eric Robishaw
Replied On April 28, 2006 04:56 PM

Updated Question: I finally figured out that I needed to cast the base Grid object to GridTableControl. NOW... How do I get the appropriate Record Row Index from the Grid Row index passed into the Draw method of the CellRenderer Class? The following DO NO return the correct row when the grid is SORTED: gtc.Table.Records[rowIndex] gtc.Table.Records(gtc.GetClientRow(rowIndex)) BOTTOM LINE QUESTION: Using GridTableControl object, and the (visible) rowIndex provided by the Draw Method of the GridCellRenderer, how do I get the correct Record?

Eric Robishaw
Replied On April 28, 2006 05:56 PM

OK... after much digging: //CAST the Grid object to GridTableControl GridTableControl gtc = (GridTableControl) Grid; //Get the underliying elemement Element el = gtc.Table.DisplayElements[rowIndex]; //Get the element Record Record record = el.ParentRecord; >Updated Question: > >I finally figured out that I needed to cast the base Grid object to GridTableControl. > >NOW... >How do I get the appropriate Record Row Index from the Grid Row index passed into the Draw method of the CellRenderer Class? > >The following DO NO return the correct row when the grid is SORTED: > >gtc.Table.Records[rowIndex] >gtc.Table.Records(gtc.GetClientRow(rowIndex)) > >BOTTOM LINE QUESTION: >Using GridTableControl object, and the (visible) rowIndex provided by the Draw Method of the GridCellRenderer, how do I get the correct Record? > >

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.

;