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?
Mike,
Sorry about that. I forgot to include the class.
Private Class Comm_FilterCondition Inherits FilterCondition Public Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) MyBase.New(info, context) End Sub Public Sub New(ByVal column As UltraGridColumn, ByVal comparisionOperator As FilterComparisionOperator, ByVal compareValue As Object) MyBase.new(column, comparisionOperator, compareValue) End Sub Public Overrides Function MeetsCriteria(ByVal row As Infragistics.Win.UltraWinGrid.UltraGridRow) As Boolean Dim cellText As String = row.Cells(Me.Column.Key).Value.ToString() If Me.ComparisionOperator = FilterComparisionOperator.Match Then Return cellText.ToLower = Me.CompareValue.ToString.ToLower Else Return cellText.Contains(Me.CompareValue.ToString()) End If End Function End Class
I can use the class here, but the question I have is why do I have to use the class? why can't the filtercondition (Option #1) get the correct records? Why does it include records that are clearly not a match?
If i ask for a filter on Territory 1, then I should only get matches for territory 1....not 11 and 21 and anything else that ends with 1.
Am i missing something with the filterconditions?
I tried putting this code in my Sub before the grid.print, but it did the same.
Perhaps I am misunderstanding the issue here. But it looks to me like you should be using Equals instead of Match.
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?
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.
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.
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 understand about the class working now because it is ignoring the .match operator.
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 appreciate your patience.
Could you explain what the MATCH operator does (for future reference)?
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.
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.