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.

Wrap text in GDBG cell

Thread ID:

Created:

Updated:

Platform:

Replies:

34649 Sep 14,2005 03:41 AM Sep 29,2005 01:37 AM Windows Forms 14
loading
Tags: GridControl
Atith Pagdi
Asked On September 14, 2005 03:41 AM

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?

Administrator [Syncfusion]
Replied On September 14, 2005 07:26 AM

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

Atith Pagdi
Replied On September 15, 2005 01:05 AM

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

Administrator [Syncfusion]
Replied On September 15, 2005 01:23 AM

Hi Athith, Here is the link: wraptextproblem.zip Regards, Jeba

Atith Pagdi
Replied On September 15, 2005 03:24 AM

Hi Jeba, It asks me for a lisence file on execution! Thanks, Atith

Atith Pagdi
Replied On September 15, 2005 03:29 AM

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

Administrator [Syncfusion]
Replied On September 15, 2005 03:42 AM

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.

Atith Pagdi
Replied On September 27, 2005 07:54 AM

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?

Administrator [Syncfusion]
Replied On September 27, 2005 08:34 AM

Hi Atith, Please refer this KB link: Reply   |   Reply with quote
Atith Pagdi
Replied On September 27, 2005 08:42 AM

Hi Jeba, I don''t see any link. Could you please provide me with the right link? Thanks, Atith

Administrator [Syncfusion]
Replied On September 27, 2005 09:00 AM

Hi Atith, Please refer this KB link: What is the difference between PrepareViewStyleInfo and Model.QueryCellInfo in a GridDataBoundGrid? Please try the style property in QueryCellInfo and see if that solves your problem. Here is the updated sample. wraptextproblem.zip Best Regards , Jeba

Atith Pagdi
Replied On September 28, 2005 06:03 AM

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

Administrator [Syncfusion]
Replied On September 28, 2005 08:29 AM

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.

Administrator [Syncfusion]
Replied On September 28, 2005 08:32 AM

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

Atith Pagdi
Replied On September 29, 2005 01:37 AM

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

CONFIRMATION

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.

;