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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Freeze Row2

Thread ID:





38811 Dec 20,2005 12:23 AM UTC Jan 10,2006 12:48 PM UTC WinForms 11
Tags: GridControl
Administrator [Syncfusion]
Asked On December 20, 2005 12:23 AM UTC

HI, I tried a bunch of stuff, but nothing''s working, so.. I build a virtual grid which then I print, Row 0 is hidden, Row1 is a large header, Row 2 is my grid header. During print, I want row2(only and not row 0-1) to repeat on every page. I tried this.Model.Rows.FreezeRange(2,2), but for some reason it takes up the space of row1! pls advise.

stanleyj [Syncfusion]
Replied On December 20, 2005 01:20 PM UTC

Hi Monica, Here is a sample that I think does what you are trying to do. http://www.syncfusion.com/Support/user/uploads/Forum_38811_b8f46f20.zip Best regards, Stanley

Administrator [Syncfusion]
Replied On December 20, 2005 07:34 PM UTC

Not sure which part you meant would work for me. I tried: this.gridControl1.Model.Rows.HeaderCount = 2; this.gridControl1.Model.Rows.FrozenCount = 2; However, this prints Row1 along with Row2 on all the pages. I want only Row2 to be on all pages. Not Row1 and not row0 (which is hidden BTW)

stanleyj [Syncfusion]
Replied On December 21, 2005 06:03 AM UTC

Hi Monica, The hidden rows are not printed, therefore Row 0 is never printed. I also hide Row 1 before printing and unhide the same row after printing. Was that not working for you? this.gridControl1.Model.Rows.Hidden[1] = true; // // // this.gridControl1.Model.Rows.Hidden[1] = false; You also need to freeze the rows so that it stays on all pages. If the sample is not similar to your implementation, please modify the sample. So that I will be able to suggest some solutions. Best regards, Stanley

Administrator [Syncfusion]
Replied On December 21, 2005 09:20 PM UTC

Look for //FIXIT 1st page I want to show row1 and row2 2nd page onwards, I only want to show row2, not row1.


stanleyj [Syncfusion]
Replied On December 22, 2005 05:56 AM UTC

Hi Monica, You also need to freeze the rows so that row2 stays on all pages after hiding row1. private int m_pagenum = 0; private void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { m_pagenum++; if(m_pagenum > 1) { gridControl1.Model.Rows.Hidden[1] = true; this.gridControl1.Model.Rows.FrozenCount = 2; } } Best regards, Stanley

Administrator [Syncfusion]
Replied On December 22, 2005 07:29 PM UTC

thanks. That works!

Administrator [Syncfusion]
Replied On December 27, 2005 08:36 PM UTC

I found another problem: Now the grid header (row2) prints on all the print pages, excpet what is happening is your print code is not taking the grid header''s height into consideration when it is trying to fit the rows in the page, hence the last row on the page is getting cutoff. How can I fix this so the last row does not get cut off. If I don''t make the row2 frozen, then the rows print perfectly fitted.

Administrator [Syncfusion]
Replied On December 27, 2005 10:46 PM UTC

One more: When printing from the preview window (print icon in toolbar), it does not print Row1 in the above sample. Works fine when printing directly from File->Print. Bug?

Administrator [Syncfusion]
Replied On December 28, 2005 11:00 AM UTC

Hi Monica, I was not able to find the last row on the page being cutoff. Can you find the issue in the attached sample? And to display Row1 in the first page while printing from PrintPreviewDialog you must handle the BeginPrint and reset the grid to the normal position. Here is a sample. Regards, Calvin.


Administrator [Syncfusion]
Replied On January 10, 2006 01:59 AM UTC

Here is the sample with the problem.. Note that from 2nd page on the height of 500 (which is the height os Row1) does not get filled. On page 2, row5 should follow row4 instead of going to page3!


Administrator [Syncfusion]
Replied On January 10, 2006 12:48 PM UTC

Hi Monica, To take the header height into consideration you have to pass the GridResizeToFitOptions.IncludeHeaders option to the RowHeights.ResizeToFit. And to avoid the header(Row1) height from being unused, we have to hide the Row1 first then, we have to set the FrozenCount. Here is a modified sample which, resets the FrozenCount to 0 before printing the page in the BeginPrint event handler. Regards, Calvin.



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