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.
Syncfusion Feedback

Store an object in a column for faster data access

Thread ID:

Created:

Updated:

Platform:

Replies:

50008 Oct 3,2006 01:26 PM UTC Oct 5,2006 08:51 AM UTC Windows Forms 3
loading
Tags: GridControl
Shawn Neidig
Asked On October 3, 2006 01:26 PM UTC

Hi,

I have implemented a virtual grid which is hooked up to an external data source. Inside GridQueryCellInfo I am currently using the row & column index to obtain each cell’s data. Instead of using the indexes, I want to store and Object in each column. The Object would be a pointer to a column in my data source. Then in GridQueryCellInfo, I could cast the Object & ask it directly for its cell value at e.RowIndex. Is there a property or way that I can store an Object that is associated with a single column?

Thanks,
Shawn

Administrator [Syncfusion]
Replied On October 4, 2006 06:42 AM UTC

Hi Shawn,

You can directly access/store the GridData object instead of using an indexer on the grid. This will avoid events and probably be a factor of 5 - 10 times faster. Please refer the below thread for more details.

http://www.syncfusion.com/Support/forums/message.aspx?MessageID=8704

Another technique that quickly populate things and avoids the events that slow down using an indexer is to use SetCellInfo, passing true and false for the last two arguments.

///
/// Changes the cell contents at a specific row and column index and allows you to suppress raising events
/// and also avoid copying the style objects.
///
/// The row index.
/// The column index.
/// The object that holds cell information.
/// A that specifies the style operation to be performed.
/// A that indicates if the operation was successful.
/// If True, the method will not raise the event.
/// If True, the method will try to assign the style object directly. This is only possible if the
/// existing cell was empty before or if modifyType is . Otherwise it will apply the object as
/// specified in modifyType.
public bool SetCellInfo(int rowIndex, int colIndex, GridStyleInfo style, StyleModifyType modifyType, bool dontRaiseSaveCellInfoEvent, bool copyReferenceOnly)

And also you can use the SetCells method to update the range of cells in a grid.

Thanks,
Haneef

Shawn Neidig
Replied On October 4, 2006 01:24 PM UTC

Hi,

I think the "faster data access" portion of the subject was misleading. A better explanation of my problem is: I need to store a C# Object in each column of my virtual grid.

Each time a column is added to my external data source I get notified & provided two pieces of information column added index & a C# Object to that column. At this point, I want to store that Object in my grid for the specific column index.

Thanks,
Shawn

Administrator [Syncfusion]
Replied On October 5, 2006 08:51 AM UTC

Hi Shawn,

You can use the Hashtable/ArrayList to store the column information in the virtual grid.

Hashtable hash= new Hashtable();
hash.Add(e.ColIndex) = Csharpobject;

Thanks,
Haneef

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.

Warning Icon 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.Close Icon

;