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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridControl: changing column and row count in runtime.

Thread ID:





17881 Aug 19,2004 02:55 AM UTC Aug 19,2004 06:09 AM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On August 19, 2004 02:55 AM UTC

Hello ! I have GridControl in virtual mode. Sometimes I should changing column count. Count of displaying columns changing in Form, that appears above grid. After I decrease column count and press OK on form, the form dissapear and grid refreshes those fields, that was below the form. After that, QueryCellInfo request data for columns, that already not in available range of columns (decreased). So, how can I synchronize internal switching of column count or row count with grid drawing process ? Thanks.

Administrator [Syncfusion]
Replied On August 19, 2004 05:08 AM UTC

Normally, in a pure virtual grid you never set grid.RowCount or grid.COlCount. Instead, you handle QueryRowCount and QueryColCount and provide the values there by setting e.Size = ??? and e.Handled = true. The values you set come directly from your datasource. Doing it this way allows the grid to work with your data without allocating space for rows and columns. If you explicitly set grid.RowCount and Grid.ColCOunt, the grid will allocate space. Now this ok if you are aware of it, and it suits your needs. But if your datasource is huge, you would probably want to avoid it. A lot of times, people will handle QueryRowCount and explicitly set grid.ColCount as the columns may be few and fixed whereas the row count may be dynamic and vary significantly. Anyway, to get changes in the number of rows or columns in your datasource to display properly, you can try calling grid.ResetVolatileData after you have changed them. If that is not sufficient, you can try calling grid.Refresh instead.

Administrator [Syncfusion]
Replied On August 19, 2004 05:22 AM UTC

Of course I operate with QueryColCount and QueryRowCount, but the problem is: I should somehow handle QueryCellInfo for column 23, after I reduce inner variable colcount from 23 to 15 and call grid.Refresh(). Cause I think Paint comes asinchronously to the grid. And it comes after I close settings form and before I call refresh :(

Administrator [Syncfusion]
Replied On August 19, 2004 06:09 AM UTC

Are you change the column count on a different thread from thh the GridControl''s thread. If so, you should wrap teh virtual events in grid.InvokeRequired checks, and then do grid.Invoke if needed to call teh handler on the grid''s thread. If you are not using separate threads, I am not sure why this problem would be happening. One thing you could try is that before you change 23 to 15, your datasource could raise an event that informs listeners that it is about to lower the column count. Then the grid could listen for this event, and try to handle any work it may need to do (like setting LeftColIndex so only ''good'' columns are visible, and maybe calling grid.CurrentCellMove to position the current cell away for a column that is no longer available after the event.)


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

Live Chat Icon For mobile
Live Chat Icon