Hello,
I'm using the trial version and trying to find out if Telerik Reporting is right for me. For the most part it's seemed like an excellent choice, but I do have one issue that I haven't been able to figure out.
For the most part, my binding will be to business objects. One item that often comes up in my business objects is a generic list of IP Addresses (System.Net.IPAddress). When I try to do this, I get a red box on my report that says
"An error has occured while processing TextBox 'TextBox1':
The expression contains object 'Item' that is not defined in the current context.
Textbox1 is within the details section, and the details section is the only section on the report.
To test this, I created a class called Addresses in 3 different ways, and used this code in my report's constructor:
Then I tried 3 different versions of the Addresses() class.
Version 1:
This produced the error above.
Version 2:
I tried the list as a string, just because that's how all the samples I saw on the site are. This produced the expected results of a nicely formatted list of IP Addresses. However, my business objects do not have the IP Addresses as Strings, they are System.Net.IPAddress objects. I just tried this one for proof of concept.
Version 3:
I tried this to to see if an IP Address as a property would render properly on the report, and it did.
With all 3 versions, I left the constructor the same way, and the textbox in the details section. It seems that as a standard property, the System.Net.IPAddress object could be rendered properly, and it also seemed that Telerik Reporting can understand a generic list, however, when I combine the two, it does not seem that Telerik Reporting can understand a Generic List of System.Net.IPAddress objects. Is this correct, or is there another method I am missing?
As an aside, if you are not familiar with System.Net.IPAddress, the familiar format of an IP address (ex. 192.168.0.1) is returned with the .ToString() method. It does not have a property to return it.
Thanks for any help you can give.
Josh
I'm using the trial version and trying to find out if Telerik Reporting is right for me. For the most part it's seemed like an excellent choice, but I do have one issue that I haven't been able to figure out.
For the most part, my binding will be to business objects. One item that often comes up in my business objects is a generic list of IP Addresses (System.Net.IPAddress). When I try to do this, I get a red box on my report that says
"An error has occured while processing TextBox 'TextBox1':
The expression contains object 'Item' that is not defined in the current context.
Textbox1 is within the details section, and the details section is the only section on the report.
To test this, I created a class called Addresses in 3 different ways, and used this code in my report's constructor:
Public Sub New() |
InitializeComponent() |
Me.DataSource = New Addresses() |
Me.TextBox1.Value = "=Fields.Item" |
End Sub |
Then I tried 3 different versions of the Addresses() class.
Version 1:
Public Class Addresses |
Inherits List(Of System.Net.IPAddress) |
Public Sub New() |
Me.Add(System.Net.IPAddress.Parse("192.168.0.1")) |
Me.Add(System.Net.IPAddress.Parse("192.168.0.2")) |
Me.Add(System.Net.IPAddress.Parse("192.168.0.3")) |
Me.Add(System.Net.IPAddress.Parse("192.168.0.4")) |
Me.Add(System.Net.IPAddress.Parse("192.168.0.5")) |
End Sub |
End Class |
Version 2:
Public Class Addresses |
Inherits List(Of String) |
Public Sub New() |
Me.Add("192.168.0.1") |
Me.Add("192.168.0.2") |
Me.Add("192.168.0.3") |
Me.Add("192.168.0.4") |
Me.Add("192.168.0.5") |
End Sub |
End Class |
Version 3:
Public Class Addresses |
Private _item As System.Net.IPAddress = System.Net.IPAddress.Parse("192.168.0.2") |
Public Property Item() As System.Net.IPAddress |
Get |
Return Me._item |
End Get |
Set(ByVal value As System.Net.IPAddress) |
Me._item = value |
End Set |
End Property |
End Class |
With all 3 versions, I left the constructor the same way, and the textbox in the details section. It seems that as a standard property, the System.Net.IPAddress object could be rendered properly, and it also seemed that Telerik Reporting can understand a generic list, however, when I combine the two, it does not seem that Telerik Reporting can understand a Generic List of System.Net.IPAddress objects. Is this correct, or is there another method I am missing?
As an aside, if you are not familiar with System.Net.IPAddress, the familiar format of an IP address (ex. 192.168.0.1) is returned with the .ToString() method. It does not have a property to return it.
Thanks for any help you can give.
Josh