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

Printing

Thread ID:

Created:

Updated:

Platform:

Replies:

20430 Oct 18,2004 10:52 PM UTC Oct 19,2004 08:35 PM UTC WinForms 5
loading
Tags: GridControl
Madhavi Balusu
Asked On October 18, 2004 10:52 PM UTC

Hi, I have DataBoundGrid which is bound to a table, but the grid does not display all the columns in the table. When the user selects print, I want to show and hide columns in the table in a different way. Some of the columns that are now visible should be hidden when printed and some should become visible. What is a good way to do this? Thanks!

Administrator [Syncfusion]
Replied On October 19, 2004 04:50 AM UTC

Handle the QueryColWidth event. In the handler, if the grid is printing (check grid.PrintingMode), then set e.Size = 0 and e.Handled = true if e.Index points to one of the columns you want to hide.

Madhavi Balusu
Replied On October 19, 2004 02:02 PM UTC

Yes, that would work for hiding the columns. What if I want to insert new columns into the grid during the printmode?

Administrator [Syncfusion]
Replied On October 19, 2004 03:29 PM UTC

You want to print columns that are not visible in the grid when you are not printing? In such a case, it might be simpler to use a second grid to print things. That way you can hide / insert what ever you want and not affect the display. Another option is to handle the other virtual events, QueryCellInfo and QueryColCount and dynamically provide the values for the extra columns. This would be tricky. All in all, using a second grid might be the simplest thing to do.

Madhavi Balusu
Replied On October 19, 2004 08:06 PM UTC

Hi Clay, In a databound grid, how do I get the DataTable (displayTable) of the grid with mapped values in the table not raw DB values? So if the table person cellvalue=4, I want the mapped display name like table cellvalue=John ( the mapped value from the db table ) Thanks.

Administrator [Syncfusion]
Replied On October 19, 2004 08:35 PM UTC

I am not sure I understand. Are you asking how to get the Display value of a ComboBox cell that uses ValueMember and DisplayMember? If so, try retrieving the FormattedText. string displayValue = this.grid[row, col].FormattedText; If you want to get the DataRowView for for grid rowIndex, then you can use: CurrencyManager cm = (CurrencyManager) this.BindingContext[grid.DataSource,grid.DataMember]; int pos = grid.Binder.RowIndexToPosition(rowIndex); DataRowView drv = cm.List[pos] as DataRowView; string someValue = drv["anycolumn"].ToString();

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.

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

;