GridDataBoundGrid

Hello,

Is there any way to print a grid without any data in it? Essentially, in our application we have the option to print a blank form - even from a form with data on it. But the "DrawGrid" method in GridControlBase prints the text as well.

So is there a way to:
A) Print the page without data in the grid (but perhaps with blank rows/columns to fill the size of the grid on the page
or
B) Print the page without data, and the grid appears to have no columns/rows (so it looks like it would when it is bound to a table with no data)

We are using 4.2.0.37

Thanks,

Jonathan Quail

3 Replies

AD Administrator Syncfusion Team August 1, 2006 06:10 AM UTC

Hi Jonathan,

Please try the attached sample that demonstrates the way to achieve this behavior.
Here is a sample
GDBG_Print.zip

Let me know if this helps for you.
Regards,
Rajagopal


JQ Jonathan Quail August 1, 2006 04:48 PM UTC

Yes that worked - We have our own Print Manager implementation, but the setting of the e.Style.CellValue in OnPrepareViewStyleInfo worked perfectly.

Just two quick questions about that though.

1. Will the setting of e.Style.CellValue have any effect on bound data? Our grids are bound to DataViews - will that change the data at all?

2. What is the purpose of calling the "Invalidate ()" before and after the print? I was able to get it to work without calling those methods. Was that just a fluke?

Thank you for your help!

Jonathan Quail


AD Administrator Syncfusion Team August 2, 2006 08:53 AM UTC

Hi Jonathan,

1. The PrepareviewStyleInfo event does not store any styleInfo properties in a grid, it just sets the visual style appearance for the grid. The idea was that to visually make the cell contents in the grid to null before printing through the PrepareviewStyleInfo event handler and reset them back after printing. This will not make any changes to the bound data.

2. There are many situations where you don''t want to re-draw the entire control but just a portion of it - and that''s where Invalidate() can be used. I have used this to avoid the painting problems that may occur when changes to the grid are made by the PrepareviewStyleInfo.

Thanks for using Syncfusion Products.
Regards,
Rajagopal

Loader.
Up arrow icon