I''m using the following line of code to wrap text in a GDBG:
this.dgTest.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(0, 1, this.dgTest.Model.RowCount, this.dgTest.Model.ColCount), GridResizeToFitOptions.IncludeHeaders);
This works fine, but for some reason, when there''s just one record in the grid, one of the cells shows "Gund Business Enterprises In" instead of "Gund Business Enterprises Inc."
Looks like it''s working fine in all other cases but this one. Any idea why this is happening and how I can fix it?
AD
Administrator
Syncfusion Team
September 14, 2005 11:26 AM UTC
Hi Atith,
Here is a sample with only one row in GridDataBoundGrid.
wraptextproblem.zip
It seems to be working fine.Could you please reproduce this issue in the attached sample? I would really appreciate if you could provide us a sample code that exhibits this behavior.
Thanks for your cooperation.
Regards,
Jeba
AP
Atith Pagdi
September 15, 2005 05:05 AM UTC
Hi Jeba,
The link doesn''t open up. Could you please give me the correct link so that I can try and reproduce my error. For your info, I''m using the GDBG and have specified the layout to contain multirow records. The GDBG is also bound to a DataTable. Please try and give me the right link as soon as possible so I can look into it. I work out of Bangalore, India; so there''s a considerable time difference if you''re in the Americas!
Thanks,
Atith
AD
Administrator
Syncfusion Team
September 15, 2005 05:23 AM UTC
Hi Athith,
Here is the link:
wraptextproblem.zip
Regards,
Jeba
AP
Atith Pagdi
September 15, 2005 07:24 AM UTC
Hi Jeba,
It asks me for a lisence file on execution!
Thanks,
Atith
AP
Atith Pagdi
September 15, 2005 07:29 AM UTC
Looks like it''s working fine! I''m unable to reproduce the error. I will get back to you in case of more problems.
Thanks Jeba!
Regards,
Atith
AD
Administrator
Syncfusion Team
September 15, 2005 07:42 AM UTC
Hi Atith,
Thanks for your update.Please feel free to contact us if you have any other concerns.
Thanks for choosing Syncfusion Products.
Best Regards,
Jeba.
AP
Atith Pagdi
September 27, 2005 11:54 AM UTC
Jeba -
I''ve noticed a peculiar thing with this. When I do a resize to fit on the DGBG, the text wraps just fine, but in cases where the text in a cell is boldened in the PrepareViewStyleInfo event handler, the text, if close to the edge of the cell gets hidden. I inferred this today. Is there a way I can handle this?
AD
Administrator
Syncfusion Team
September 27, 2005 12:34 PM UTC
Hi Atith,
Please refer this KB link:
AP
Atith Pagdi
September 27, 2005 12:42 PM UTC
Hi Jeba,
I don''t see any link. Could you please provide me with the right link?
Thanks,
Atith
AP
Atith Pagdi
September 28, 2005 10:03 AM UTC
Hi Jeba,
I moved the code to make the text "BOLD" from the PrepareViewStyleInfo handler to the QueryCellInfo handler and it seems to work all right.
What''s the behaviour of the QueryCellInfo handler? When is it triggerred? And why do you think this wasn''t happening when the same code was written in the PrepareViewStyleInfo handler?
Thanks,
Atith
AD
Administrator
Syncfusion Team
September 28, 2005 12:29 PM UTC
Hi Atith,
PrepareViewStyleInfo is cell level paint event. It is generally used to modify style properties immediately before the style is used to draw the cell. So, if you have a property setting that is transient in that it dynamcailly changes and is only needed for drawing (like the backcolor depending upon the cellvalue), then PrepareViewStyleInfo is the place to do this work.This event, PrepareViewStyleInfo, allows you to make dynamic changes that do not depend on the underlying data, but instead depend on things like where the current cell is.
QueryCellInfo is hit whenever the grid needs a cell style for any reason.The QueryCellInfo architecture to provide the style information dynamically is by design. So if you move your mouse over the grid, it will be called as the mouse moves (the grid needs the cell style to do hit testing).If you move or click any scrollbars or moving the size of the form or screen it will be called. Or, if you callgrid.Refresh or grid.Invalidate or grid.RefreshRange then QueryCellInfo would be hit .Normally, the way you force the event to be raised is to call either grid.Refresh or grid.Invalidate grid.RefreshRange since drawing the cells require the style.
So QueryCellInfo is hit prior to PrepareViewStyleInfo, and may be hit for other reasons than preparing the style for drawing. If you use code like grid[row, col], then QueryCellInfo is hit, but PrepareViewStyleInfo is not hit. So, if you are setting a style property that may be of use to you for something other than be drawn a certain way, then you should use QueryCellInfo to set the property dynamically. Hence if you want to set the cell styles properites dynamically depending on the underlying datasource in the dataset then you will have to handle Model.QueryCellInfo handler .
Best Regards,
Jeba.
AD
Administrator
Syncfusion Team
September 28, 2005 12:32 PM UTC
Atith,
PrepareViewStyleInfo only gets called just before the cell is drawn and its settings will get disposed immediately after drawing the cell. It will get called for each view on the grid and can contain view context (e.g. outline cells bold if they are the current cell or on the current row etc).
ResizeToFit only calls grid[row, col] to get the style from the model. The resizing is based on the data that are the same across each view of the model and are independent of view-specific context.
Stefan
>Hi Jeba,
>
>I moved the code to make the text "BOLD" from the PrepareViewStyleInfo handler to the QueryCellInfo handler and it seems to work all right.
>
>What''s the behaviour of the QueryCellInfo handler? When is it triggerred? And why do you think this wasn''t happening when the same code was written in the PrepareViewStyleInfo handler?
>
>Thanks,
>Atith
AP
Atith Pagdi
September 29, 2005 05:37 AM UTC
Thanks guys, for the feedback. I''m new to Syncfusion tools, hence there''s quite some ambiguity here. Being from the web development area, it''s pretty tough to come to terms with the number of properties windows controls have to offer. :-)
What I''m doing is this: I get a dataset from the DB and then bind it to the GDBG by specifying the layout as a multirow record. Depending on certain fields in each datarow, I need to set/unset the font of certain other fields in the row. I was struggling with this initially, but with Clay Burch''s help, I got the basic thing working by writing code in the PrepareViewStyleInfo handler. Obviously when the user selects a record, the formatting was going haywire in that some of the fields which were bold, were set to a normal font! For this I included another section in the PrepareViewStyleInfo handler which determined if the cell was a selected one or not and if it was, I was resetting the bold font.
Now what I''ve done to rectify this is I''ve moved the code from where we check is the row''s a selected one in the PrepareViewStyleInfo handler to the QueryCellInfo handler. This seems to work as expected.
Are you trying to say that even if I move all my code from PrepareViewStyleInfo (in which I set the styles of cells depending on their positions and the values in some other cells) to QueryCellInfo, I should be able to get the same results?
Thanks,
Atith