I am doing some formating in my InitializeRow event.
I am checking the e.ReInitialize argument to test if it is a re-initialize or not.
When I perform a grid print using UltraGridPrintDocument the InitializeRow event fires and I test the e.ReInitialize argument. It is false.
Shouldn't it be true here?
I don't want to reformat all that data again.
Does anyone have a similar issue?
-duane
Hi Duane,
KDuaneS said:Shouldn't it be true here?
No. :)
The reason it's false is that when you print, the grid layout is cloned and so are all the rows (which are part of the layout). So the row you are initializing is not the same row as the one on the screen and it is being initialized for the first time.
You can check e.Row.Layout.IsPrintLayout to determine if a row is part of the print layout, as opposed to the on-screen grid.
Hey Mike,
I did not know it cloned the gridlayout like that. That would explain it.
So, since it does clone the layout, I am assuming I can get to the printout layout and modify it without effecting my grid layout?
Can I apply appstyles to it?
KDuaneS said:So, since it does clone the layout, I am assuming I can get to the printout layout and modify it without effecting my grid layout?
Yes, you can. That's the main reason we do it. :)
KDuaneS said:Can I apply appstyles to it?
Well, Appstyling is static to the application. So you can't apply a different Application Style to the printed layout than you have applied to the on-screen layout.
Mike,
My filters were working well until I put them into the InitializePrint event. I like the fact that I can change the layouts in there instead of changing my screen layout. I am assuming I can also change the filtering in the InitializePrint event.
I ran into a problem with this.
I set a filter variable in code and pick it up in the InitializePrint event( it is called _terrSort).
_terrSort is a 2 digit code (1 to 99).
If I run the following code with _terrSort=1 using code option #1 I get 1's, 11's and 21's.
If I run the following code with _terrSort=1 using code option #2 I get only 1's(which is correct).
Option #2 uses the class I built, but the code in option #1 does the same thing.
Why do I get two different sets of results?
Private Sub ug_CommissionDetail_InitializePrint(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelablePrintEventArgs) Handles ug_CommissionDetail.InitializePrint If e.PrintLayout.IsPrintLayout Then Dim colfilter As ColumnFilter Dim column As UltraGridColumn colfilter = e.PrintLayout.Bands(0).ColumnFilters("PTRTRY") column = e.PrintLayout.Bands(0).Columns("PTRTRY")
With e.PrintLayout.Bands(0) .ColumnFilters.ClearAllFilters()option 1---> .ColumnFilters("PTRTRY").FilterConditions.Add(FilterComparisionOperator.Match, _terrSort)
option 2---> colfilter.FilterConditions.Add(New Comm_FilterCondition(column,
FilterComparisionOperator.Match, _terrSort))
End With
End If
I'm not sure I understand the question. Clearly, if you are getting different results, then your Comm_FilterCondition class's MeetsCriteria method must be doing something differently then the grid's default filtering logic.
Since I don't have you Comm_FilterCondition class, I don't see what useful advice I can offer you on why that's happening.