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.

Fastest way to set a cell value

Thread ID:





30790 Jun 23,2005 05:24 PM Jun 24,2005 09:48 AM Windows Forms 5
Tags: GridControl
Administrator [Syncfusion]
Asked On June 23, 2005 05:24 PM

Clay, Is the a faster way to set a cell value in the GDBG other than this.grid[1,1].Text? Regards, Thomas

Administrator [Syncfusion]
Replied On June 23, 2005 06:15 PM

The most effiecient way to do it is to directly access the datasource. eg, this.dataTable1.Rows[0]["Col0"] = somevalue;

Administrator [Syncfusion]
Replied On June 24, 2005 01:12 AM

Ok, thanks. I case of a unbound coulumn? I''m checking the time with a code profiler and see that the value modification of a cell takes a bit a long time. Regards, Thomas

Administrator [Syncfusion]
Replied On June 24, 2005 04:13 AM

In an unbound grid that stores data in the GridControl.Data object, then setting the value using grid.SetCellInfo with the proper flags set, or directly accessing grid.Data[row, col] as below, will avoid events and perform 5-10 faster that just directly indexing the GridControl.
GridStyleInfo style = null;
if(grid.Data[row, col] != null
   style = new GridStyleInfo(grid.Data[row, col]);
   style = new GridStyleInfo();
style.Text = "something";
grid.Data[row, col] = style.Store;

Administrator [Syncfusion]
Replied On June 24, 2005 07:53 AM

Thanks Clay. Now, I have to set the Tag property of the header cell in a GDBG. Did you see any problem when I use this code in my implementation: GridStyleInfoStore store = this.Model.Data[0, 0]; store.SetValue( store.FindStyleInfoProperty( "Tag" ), "Error" ); The performance is great this way. Regards, Thomas

Administrator [Syncfusion]
Replied On June 24, 2005 09:48 AM

I think this should be OK. You could not venture past row 0 (and probably column 10) as there is no storage allocated in the Data object past those limits.


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.