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
close icon

current cell

Hi, Why you don''t use the event parameter in QueryCellInfo to pass the information of the CurrentCell ? ex. GridQueryCellInfoEventArgs.IsCurrentCell or GridStyleInfo.IsCurrentCell Now I must call the Grid.CurrentCell.HasCurrentCellAt(..) method every time. Is not another way ? Regards

12 Replies

AD Administrator Syncfusion Team January 29, 2005 11:06 AM UTC

You can use HasCurrentCellAt or you can check e,RowIndex and e.ColIndex against grid.CurrentCell.RowIndex/ColIndex. QueryCellInfo is hit very often. Adding the overhead of passing currentcell information which might not be useful for many applications and would come at a performance cost.


ST Stefan Tsalapatis January 29, 2005 12:12 PM UTC

Another one question. Inside QueryCellInfo I set if ... Grid[row,col].ReadOnly=true; When QueryCellInfo reference to this cell then e.Style.ReadOnly doesn''t return true Where is my mistake ? Thanks


AD Administrator Syncfusion Team January 29, 2005 12:21 PM UTC

You set values in QueryCellInfo by setting e.Style.ReadOnly = true. You do not do it in QueryCellInfo by setting grid[e.RowIndex, e.ColIndex].ReadOnly = true.


ST Stefan Tsalapatis January 29, 2005 12:26 PM UTC

I need inside QueryCellInfo in a Virtual Grid to change the behavior of certain cells according to values of another cells How to succeed this ? >You set values in QueryCellInfo by setting e.Style.ReadOnly = true. > >You do not do it in QueryCellInfo by setting grid[e.RowIndex, e.ColIndex].ReadOnly = true.


ST Stefan Tsalapatis January 29, 2005 01:37 PM UTC

even if I set in CurrentCellMoving of the specific cell for another cell Grid[Row,Col].ReadOnly or Enabled then inside QueryCellInfo the e.style doesn''t change. I hope to be my mistake


AD Administrator Syncfusion Team January 29, 2005 01:51 PM UTC

>>I need inside QueryCellInfo in a Virtual Grid to change the behavior of certain cells according to values of another cells How to succeed this ? When e.ColIndex and e.RowIndex point to one of the ''certain cells'', then use grid[e.RowIndex, someColIndex] to retrieve the ''values of another cells''. Based on this retrieved value, set e.Style. The idea is that in QueryCellInfo, you provide the proper value of e.Style for the given e.ColIndex and e.RowIndex. If this means getting another value from a different cell and testing it, then you get this value by indexing the grid to retrieve it. In this manner, you are not ''setting'' a value using grid[row,col].ReadOnly = true. Instead, you are dynamically providing e.Style.ReadOnly when you want the e.ColIndex and e.RowIndex cell to be readonly (doing what ever test you need to do to decide this). One last comment, is if someColIndex (mentioned above) turns out to be e.ColIndex, then do not try to retrieve the value using an indexer on teh grid. Instead, get it directly from e.Style.CellValue. If you try to use an indexer in this case, you will set up a recursive call into QueryCellInfo.


ST Stefan Tsalapatis January 29, 2005 02:05 PM UTC

>When e.ColIndex and e.RowIndex point to one of the ''certain cells'', then use grid[e.RowIndex, someColIndex] to retrieve the ''values >of another cells''. Based on this retrieved value, set e.Style. One Cell when is modified influence 10 others . From there is the normal thing to change the other''s behavior. Even in CurrentCellChanged event I change the Grid[r,c].Readonly or Enabled. Later in QueryCellInfo I can not catch the change. if( e.style.ReadOnly) { never execute } So the question is How dynamically I change the behavior ? Sorry if I do not understand something obvious. >> If you try to use an indexer in this case, you will set up a recursive call into QueryCellInfo. In QueryCellInfo only if you reference to the same cell with the GridQueryCellInfoEventArgs


AD Administrator Syncfusion Team January 29, 2005 05:50 PM UTC

You are using a GridControl, correct? You cannot set properties on indivdual cells in a GridDataBoundGrid. Another comment is that if a cell is set (using an indexer) to be readonly, you cannot use an indexer to change the style unless you set grid.IgnoreReadOnly = true first. Here is a sample using QueryCellInfo that makes cells in col 4 readonly if the cells in col1 and col2 hold numbers, and their sum is greater than 10. http://www.syncfusion.com/forums/Uploads/GC_QCI_forum.zip


ST Stefan Tsalapatis January 29, 2005 09:35 PM UTC

Thanks Clay for your sample. Yes I have understood from your previous post your thought. To change the dependent cells style into QueryCellInfo looking for the master cell''s value and take the appropriate action. But the needs of analysis are different. When master cell are changing or even fetching the value from the datasource, it lookups to an auxiliary datasource to find the new states. This very moment I have the information to manage the other cells. If I go with the opposite logic from the dependent cells to update the states, I must do the lookup inside QueryCellInfo for every one dependent cell and this has a performance penalty. Because in this specific case I do not expect a lot of rows I found a solution to hold a states array for all rows which is updated when QueryRowCount is raised , or when master cell is changing from the user. But in general I believe it would be real useful to be able to change styles from the master cell. Thanks for your support Regards >You are using a GridControl, correct? You cannot set properties on indivdual cells in a GridDataBoundGrid. > >Another comment is that if a cell is set (using an indexer) to be readonly, you cannot use an indexer to change the style unless you set grid.IgnoreReadOnly = true first. > >Here is a sample using QueryCellInfo that makes cells in col 4 readonly if the cells in col1 and col2 hold numbers, and their sum is greater than 10. > >http://www.syncfusion.com/forums/Uploads/GC_QCI_forum.zip


AD Administrator Syncfusion Team January 30, 2005 06:31 AM UTC

Are you using a GridControl where the GridControl actually stores the data in its GridData object? (ie., you are not handling SaveCellInfo.) So, when a master cell changes, you want to explicitly change the styles of several slave cells, correct? If you want to do it this way, why use QueryCellInfo at all? Just always set the style objects in the grid using an indexer when the master cell changes. Then the default QueryCellInfo should retrieve the properly set style object without you having to adjust it.


AD Administrator Syncfusion Team January 30, 2005 07:43 AM UTC

No , I don''t store any data . I handle everything from QueryCellInfo and SaveCellInfo. I will open a Direct-Track incident and I will send you the sample.


AD Administrator Syncfusion Team January 30, 2005 07:48 AM UTC

If you are handling all the saving in SaveCellInfo, does your SaveCellInfo save the ReadOnly settings in your datasource? And does your QueryCellInfo set these ReadOnly setting from your datasource? If not, then setting grid[row, col].ReadOnly will not work.

Loader.
Live Chat Icon For mobile
Up arrow icon