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.
KDuaneS said: Yes, I am speaking of the Intellisense List. The FilterComparisionOperator.Equals does not exist. I can type it in and it does work, but it is not in the intellisense. I am running version 20081.2161 ONLY. That is what is in my References. I had to uninstall all previous versions to get 2161 to install. There are no other versions installed on this machine. Is there any other place I should be looking to determine if the FilterComparisionOperator has multiple definitions? But we also have a second machine here running 20081.2150 and the .Equals does not exist on it either. It is possible that is was missing from the IG installs.
Yes, I am speaking of the Intellisense List. The FilterComparisionOperator.Equals does not exist. I can type it in and it does work, but it is not in the intellisense.
I am running version 20081.2161 ONLY. That is what is in my References. I had to uninstall all previous versions to get 2161 to install. There are no other versions installed on this machine. Is there any other place I should be looking to determine if the FilterComparisionOperator has multiple definitions?
But we also have a second machine here running 20081.2150 and the .Equals does not exist on it either.
It is possible that is was missing from the IG installs.
I just tested this out again, but this time in VB, and I get the same problem. My guess is that VB considers the word "Equals" some kind of keyword or it is getting confused because of the Equals method on an object.
So it looks like this is a bug or a quirk in VB.
KDuaneS said:Could you explain what the MATCH operator does (for future reference)?
All of the operators are documented in the help.
I understand about the class working now because it is ignoring the .match operator.
I appreciate your patience.
Could you explain what the MATCH operator does (for future reference)?
KDuaneS said:I went ahead and tried it anyway and it worked. Any reason why it is not in the list, yet it is accepted?
To what list are you referring? The Intellisense list in Visual Studio shows all of the enum values for me, including Equals. If it's not showing up on yours, then something is wrong on your machine or your installation of Visual Studio. Maybe there are multiple definitions of FilterComparisionOperator in your project or something.
KDuaneS said: Well, "Match" worked in the class i built, so I thought it should have worked in the other code too. That is really confusing and frustrating to me when code will work in one place and not in another. I don't like guessing until I find something that works. It takes too much time I appreciate your time helping me find something so simple.
Well, "Match" worked in the class i built, so I thought it should have worked in the other code too. That is really confusing and frustrating to me when code will work in one place and not in another.
I don't like guessing until I find something that works. It takes too much time
I appreciate your time helping me find something so simple.
Match works in the class you built because the operator is completely irrelevant in the class you built. You are overriding the MeetsCriteria method and only returning true when the values are equal. The operator in that case is provided so that you can use it if you want to, but your code is basically ignoring it and performing an Equals comparison on the value.
I thought the same thing, but it is not in the list. I thought that strange.
I went ahead and tried it anyway and it worked. Any reason why it is not in the list, yet it is accepted?
Perhaps I am misunderstanding the issue here. But it looks to me like you should be using Equals instead of Match.