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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Fastest way to set a cell value

Thread ID:





30790 Jun 23,2005 09:24 PM UTC Jun 24,2005 01:48 PM UTC WinForms 5
Tags: GridControl
Administrator [Syncfusion]
Asked On June 23, 2005 09:24 PM UTC

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 10:15 PM UTC

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 05:12 AM UTC

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 08:13 AM UTC

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 11:53 AM UTC

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 01:48 PM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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