Telerik Forums
Reporting Forum
2 answers
342 views
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:
    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 
This produced the error above.

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 
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:
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 
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
Josh Fruits
Top achievements
Rank 1
 answered on 18 Aug 2009
1 answer
162 views
I dont know what I have done wrong. I have a chart, the chart needs a datasource. This is my NeedDataSource-method

private

 

void companyBooking_NeedDataSource(object sender, System.EventArgs e)

 

{

Telerik.Reporting.Processing.

Chart companyBookingChart = sender as Telerik.Reporting.Processing.Chart;

 

companyBookingChart.DataSource =

this.bokadoktornDataSetTableAdapter1.GetData();

 

}

In the InitializeComponent()-method I have this eventHandler.
this.companyBookingChart.NeedDataSource += new System.EventHandler(this.companyBooking_NeedDataSource);

This is my database-sqlquery, (Works fine)

SELECT YEAR(BookedDate) AS Year, MONTH(BookedDate) AS Month, CONCAT(u.FirstName, ' ', u.LastName) AS FullName, Count(*) AS NoOfBookings
FROM         Bookings b
INNER JOIN Users u ON u.Id = b.BookedById
INNER JOIN CompanyUsers cu ON cu.Id = u.Id
WHERE cu.CompanyId = 1
GROUP BY u.Id, MONTH(BookedDate), YEAR(BookedDate)
ORDER BY NoOfBookings DESC;

When I preview my report nothing happends. I dont know why, everything worked fine until I added my chart. Is it something wrong with my NeedDataSource-method.

Thanks
/Emil

 

Chavdar
Telerik team
 answered on 18 Aug 2009
1 answer
97 views
Hi
In a textbox in detail section, i have to display either low or medium or high based upon the value of another textbox(in detail section), which takes value from the database. Where should i write the if condition statements?
Ivan
Telerik team
 answered on 18 Aug 2009
4 answers
180 views
Hey folks,

I got a weird and annoying problem here in my report:

When using a CheckBox element in a Telerik Report it alway appears blue in color. To avoid that, I decided to create my own icons for CheckedImage and UncheckedImage. Unfortunately I can't attach this gifs to this post. But they are just squares with a border of 1px and a widht/height of 13px. The checked one is just a filled square.

But whatever I do - in mein PDF Export. The icon is a little bit bigger than the original one. An ugly effect is then, that my square has either a 2px border on the left, on the right, on top OR at the bottom, which doesn't look nice on the screen and on a printed out document.

What am I doing wrong?

Thanks in advance
Peter Voigtmann
Top achievements
Rank 1
 answered on 18 Aug 2009
2 answers
79 views
In the help file (Telerik_Reporting_2009_2_701_manual.chm) you say that "All exporting format extensions and the data processing are part of Telerik.Reporting.Processing.dll" However in the KB (http://www.telerik.com/support/kb/reporting/general/deploying-telerik-reporting.aspx) you do not mention that file.

I have a previous version running.
 -- What old Telerik dlls can I remove from the references?
 -- What references do I need to deploy the Q2 2009 reports in win forms?

Thanks,

Matthew
Matthew Hile
Top achievements
Rank 1
 answered on 17 Aug 2009
3 answers
174 views
Hi,
I was testing the latest build (3.1.9.807) for the medium trust support with this code:
protected void Page_Init(object sender, EventArgs e) 
        { 
            Swh.Ih7.Reports.ShopInvoice report = new Swh.Ih7.Reports.ShopInvoice(); 
            report.OrderID = new Guid(Request.QueryString["OrderID"]); 
 
            DisplayPDF(report); 
        } 
 
        void DisplayPDF(Telerik.Reporting.Report reportToExport) 
        { 
            ReportProcessor reportProcessor = new ReportProcessor(); 
            RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, null); 
 
            string fileName = result.DocumentName + ".pdf"
 
            Response.Clear(); 
            Response.ContentType = result.MimeType; 
            Response.Cache.SetCacheability(HttpCacheability.Private); 
            Response.Expires = -1; 
            Response.Buffer = false
 
            Response.AddHeader("Content-Disposition"
                               string.Format("{0};FileName=\"{1}\""
                                             "attachment"
                                             fileName)); 
 
            Response.OutputStream.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); 
            Response.End();  


But I'm getting security exception:
Server Error in '/' Application. 
-------------------------------------------------------------------------------- 
 
Security Exception  
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.  
 
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutralPublicKeyToken=b77a5c561934e089' failed. 
 
Source Error:  
 
 
[No relevant source lines] 
  
 
Source File: App_Web_zzaoc31d.4.cs    Line: 0  
 
Stack Trace:  
 
 
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutralPublicKeyToken=b77a5c561934e089' failed.] 
   Telerik.Reporting.Pdf.Rendering.PdfRenderer.DrawString(String text, PdfFont font, Brush brush, RectangleF rect, Boolean rightToLeft) +0 
   Telerik.Reporting.Pdf.Drawing.PdfGraphics.DrawString(String s, Font font, Brush brush, RectangleF rect, StringFormat format) +124 
   Telerik.Reporting.ImageRendering.CanvasPdf.DrawString(String s, Font font, Brush brush, RectangleF rect, StringFormat format) +107 
   Telerik.Reporting.ImageRendering.TextLine.Render() +1436 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderToPage(RectangleRF clip, RoundedFloat parentLeft, RoundedFloat parentTop) +1864 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderChildren(RectangleRF clip) +161 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderToPage(RectangleRF clip, RoundedFloat parentLeft, RoundedFloat parentTop) +1970 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderChildren(RectangleRF clip) +161 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderToPage(RectangleRF clip, RoundedFloat parentLeft, RoundedFloat parentTop) +1970 
   Telerik.Reporting.ImageRendering.CompositionBase.RenderPageSection(PageArea pageArea, RenderingElement pageSection, Single height) +339 
   Telerik.Reporting.ImageRendering.CompositionBase.ApplyPageSections() +311 
   Telerik.Reporting.ImageRendering.CompositionBase.SendPhysicalPages(Boolean force) +52 
   Telerik.Reporting.ImageRendering.CompositionBase.End() +75 
   Telerik.Reporting.ImageRendering.CompositionPdf.End() +39 
   Telerik.Reporting.ImageRendering.CompositionBase.Dispose(Boolean disposing) +22 
   Telerik.Reporting.ImageRendering.CompositionPdf.Dispose(Boolean disposing) +11 
   Telerik.Reporting.ImageRendering.CompositionBase.System.IDisposable.Dispose() +17 
   Telerik.Reporting.ImageRendering.ImageRendererBase.RenderReport(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +242 
   Telerik.Reporting.ImageRendering.ImageRendererBase.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +21 
   Telerik.Reporting.Processing.ReportProcessor.Render(IList`1 reports, ExtensionInfo extensionInfo, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback) +353 
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName) +421 
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo) +108 
   Swh.Reports.Web.UI._Default.DisplayPDF(Report reportToExport) +91 
   Swh.Reports.Web.UI._Default.Page_Init(Object sender, EventArgs e) +184 
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 
   System.Web.UI.Control.OnInit(EventArgs e) +99 
   System.Web.UI.Page.OnInit(EventArgs e) +12 
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
   System.Web.UI.Page.ProcessRequest() +80 
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
   ASP.ih7shopinvoice_aspx.ProcessRequest(HttpContext context) in App_Web_zzaoc31d.4.cs:0 
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
 
  
 
 
-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082  



Chavdar
Telerik team
 answered on 17 Aug 2009
2 answers
116 views
Hi,

I have a StackedBar100 chart in my report, everything works fine, but the problem is the appereance of the percentage result in the Bar.
For example: If I have a bar divided in two or more... the first value appears in the botton of the second part of bar and the other value appears in the top of the second part of the bar. I'd like to see each value appearing inside the correct bar.
Is that possible??

Another Question: I think this code is not good... maybe there is an easy way to do that with the same result.. isnt there??

Thanks...

Code:


    DataTable GetData()
        {
            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("Descricao", typeof(string));
            dataTable.Columns.Add("Qtd1", typeof(int));
            dataTable.Columns.Add("Qtd2", typeof(int));
            dataTable.Rows.Add(new object[] { "A", 3, 5 });
            dataTable.Rows.Add(new object[] { "B", 2, 5 });
            dataTable.Rows.Add(new object[] { "C", 5, 5 });
            return dataTable;
        }


    private void chart2_NeedDataSource(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();
                dt = GetData();


                Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart;
                chart2.Series.Clear();
                
                ChartSeries s = null;

                for (int i = 0; i < dt.Columns.Count -1; i++)
                {
                    s = new ChartSeries();
                    s.Type = ChartSeriesType.StackedBar100;
                    s.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
                    s.DefaultLabelValue = "#%";
                    
                    
                    chart2.Series.Add(s);

                    foreach (DataRow row in dt.Rows)
                    {
                        ChartSeriesItem item = new ChartSeriesItem();
                        item.YValue = Convert.ToDouble(row[i+1]);
                        s.AddItem(item);

                    }
                    
                }

                foreach (DataRow row in dt.Rows)
                {
                    s.PlotArea.XAxis.AutoScale = false; //false permite gerar o xaxis com os valores que eu definir
                    s.PlotArea.XAxis.AddItem((string)row["Descricao"]);

                }


            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Angelo
Top achievements
Rank 1
 answered on 17 Aug 2009
1 answer
67 views
hi
When i am adding a second report file in the solution i m getting errors .I would be thankful if anyone helps me in adding two reports in a single solution
Chavdar
Telerik team
 answered on 17 Aug 2009
6 answers
190 views
I need to change the order of the formats listed in the Export dropdown.  I know I can rename and hide formats, but is there a way to reorder them?

Thanks,
-Stephen
Steve
Telerik team
 answered on 14 Aug 2009
5 answers
348 views
I need to include hyperlinks in my reports when they are rendered in the Web Viewer.  I'm currently using Q3 2008 and everything works fine.  I set the text of the textbox to include HTML like <a href="google.com">Click Me</a>.

I'm in the process of upgrading to Q1 2009, but it looks like my approach doesn't work anymore.  It seems the size of the textbox gets calculated based on the size of the text (including all the HTML code) so the textbox gets really large (even though when the browser processes the text, it's considerably smaller). 

So if I have a textbox who's Text is set to <a href="http://AReallyReallyReallyReallyReallyReallyLongLink.com">Q</a>, the textbox takes up a huge area but it ends up being only 1 characeter.

I thought I might be able to use the HtmlTextBox but it seems to completly ignore (and remove) hyperlinks.

Any suggestions?

Thanks,
-Stephen
Steve
Telerik team
 answered on 13 Aug 2009
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?