Telerik Forums
Reporting Forum
1 answer
74 views
we plan to use Telerik reporting but we want to know
1- is it full RTL support. if not, is there is plan to support full RTL?
2- is there run time designer and it can be localized?
Steve
Telerik team
 answered on 03 Jan 2012
1 answer
194 views

Hi Telerik,

I followed instructions from Telerik TV -  Getting Started with the Silverlight Report Viewer for Telerik Reporting .After following the instruction correctly, running my web using localhost (debug mode of VS 2010) the report is showing in the reportviewer. The report's data source is coming from Godaddy web hosting SQL Database.

But after publishing the web, i got this error inside the report viewer.

Error: System.Reflection.TargetInvocationException : An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.
   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at Telerik.Reporting.Service.SilverlightClient.RenderAndCacheEventArgs.get_RenderingResult()
   at Telerik.ReportViewer.Silverlight.ReportViewerModel.OnRenderAndCacheCompleted(Object sender, RenderAndCacheEventArgs e)

------------- InnerException: -------------

System.ServiceModel.CommunicationException : The remote server returned an error: NotFound.
   at System.ServiceModel.Channels.Remoting.RealProxy.Invoke(Object[] args)
   at proxy_8.EndRenderAndCache(IAsyncResult )
   at Telerik.Reporting.Service.SilverlightClient.ReportServiceClient.OnEndRenderAndCache(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

------------- InnerException: -------------

System.Net.WebException : The remote server returned an error: NotFound.
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

------------- InnerException: -------------

System.Net.WebException : The remote server returned an error: NotFound.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)

Any idea ?

 

Robert
Top achievements
Rank 1
 answered on 02 Jan 2012
0 answers
96 views
Hi,

I am newer in Telerik report. I have downloaded Telerik_Reporting_Q3_2011_v5_3_11_1116_Dev and installed it in our asp.net 2010 web project.I have already a webpage it shows some result.I want to save this webpage content using Reporting .How can I achieve this?
Also when I use this telerik report ,should I replace my current webpage display  format ?

Thanks & Regards,
Sindu.
Sindu
Top achievements
Rank 1
 asked on 02 Jan 2012
11 answers
165 views
Hi telerik,

I´m new in telerik's reporting and after created my report, I want create filters for that, for exemple, imagine that I have a list of products and I want filter them for Date or something else.

How I can do that? I cannot find any info about this in the internet.

Thanks for the help,
Manuel
Top achievements
Rank 1
 answered on 30 Dec 2011
1 answer
113 views
In the attached image, how do I resize all of the textboxes in the given row, when text wraps in one of the others?

Elian
Telerik team
 answered on 30 Dec 2011
3 answers
1.2K+ views

I have a generic ASCX control that uses the Telerik ReportViewer and I want to use that for all my reporting output. But, we run into the problem that we need to provide a Report object (as well as ReportParameters) to that viewer control. Here's how I did it:

1. In my case, I know my report assembly. With just a bit more work, the assembly itself could be passed in, but the following still uses reflection to load the report dynamically.

2. ReportParameters are passed in as "Name=Value;[Name=Value;...]" via a single public property named ReportParametersString. Not particularly extensible, but more than sufficient for my simple needs. I handle type coercion (that is, convert from string that is passed into ASCX parameter to specific type supported by Telerik) using the GetTypeFromReportType method. I also have (of course, we all do...) my own DAL (data access layer) using ADO.NET that can convert from just about any input type to any output type (not documented below).

3. In my report assembly, I purposely provide a dummy empty class to make getting the assembly type that much easier.

4. I assume that the report itself can handle its own datasource needs (more on that in another post--I cracked some code to get my own data connection string without needing to modify web.config which is owned by SharePoint not by me...).

5. My ASCX exposes a ReportName property that can be the absolute or relative class name of the report to load.

So here's the code, hope it's useful!

 

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ArchG2.Portal.rg2SupportingControls.Misc
{
 /// <summary>
 /// Generic reporting viewer for any Telerik report
 /// </summary>
 public partial class TelerikReportViewer : Utils.BaseManageableControl
 {
  private string _reportName;
  private string _prevReportName;
  private Telerik.Reporting.IReportDocument _report;
  private bool _pageIsLoaded;
  private string _reportParametersString;
  private Telerik.Reporting.ReportParameterCollection _reportParameters = new Telerik.Reporting.ReportParameterCollection();
  private TextBox _txtHeight;

  /// <summary>
  /// Handle a resize by applying the resize directly to the control
  /// </summary>
  protected override void resizeHandler()
  {
   if (Width != Unit.Empty)
   {
    // set an explicit width to the report
    rptvw.Width = Width;
   } //if
   if (Height != Unit.Empty)
   {
    // set an explicit height to the report
    rptvw.Height = Height;
   } //if
  } //resizeHandler

  /// <summary>
  /// Invoked whenever the report must definitely be set in the view control.
  /// Will force the view to update / take any other actions.
  /// </summary>
  private void setReport()
  {
   // access our stored report
   Telerik.Reporting.IReportDocument theReport = Report;
   if (theReport == null)
   {
    LH.warn("No report specified; cannot display");
    return;
   } //if

   // set the report itself in the managed viewer
   rptvw.Report = Report;
  } //setReport

  /// <summary>
  /// Given a Telerik reporting type, return a "real" object type so that we can
  /// perform type-safe coercion on data values
  /// </summary>
  /// <param name="reportType">The Telerik report type to convert</param>
  /// <returns>The OS type or an exception if this is an unknown type (new Telerik version could introduce this problem)</returns>
  private Type GetTypeFromReportType(Telerik.Reporting.ReportParameterType reportType)
  {
   switch (reportType)
   {
    case Telerik.Reporting.ReportParameterType.Boolean:
     return typeof(Boolean);
    case Telerik.Reporting.ReportParameterType.DateTime:
     return typeof(DateTime);
    case Telerik.Reporting.ReportParameterType.Float:
     return typeof(double);
    case Telerik.Reporting.ReportParameterType.Integer:
     return typeof(int);
    case Telerik.Reporting.ReportParameterType.String:
     return typeof(string);
    default:
     throw new ApplicationException(
      string.Format("Unknown report type: {0}", reportType.ToString())
     );
   } //switch
  } //GetTypeFromReportType

  /// <summary>
  /// Use reflection to load a given report object from the ArchG2.Reporting assembly.
  /// </summary>
  private void loadReport()
  {
   string flag = "";
   try
   {
    // leverage the Dummy class to get access to the ArchG2.Reporting assembly
    flag = "access_archg2_report";
    Type typeDummy = typeof(ArchG2.Reporting.Dummy);
    System.Reflection.Assembly assemblyArchG2Reporting = typeDummy.Assembly;

    // check to see if the user passed in a full path or a short path
    flag = "load_report";
    string reportToLoad = _reportName;
    int idxDot = reportToLoad.IndexOf('.');
    if (idxDot <= 0)
    {
     string prefix = assemblyArchG2Reporting.GetName().Name;
     if (idxDot < 0) prefix += ".";
     reportToLoad = reportToLoad.Insert(0, prefix);
    } //if
    LH.debug("Loading report ", reportToLoad, " (", _reportName, ")");
    Type typeOfDynamicReport = assemblyArchG2Reporting.GetType(reportToLoad);

    // now instantiate an object of the report; must have default ctor
    flag = "create_report";
    object oReport = Activator.CreateInstance(typeOfDynamicReport);

    // validate the report
    flag = "validate_report";
    Telerik.Reporting.IReportDocument theReport = oReport as Telerik.Reporting.IReportDocument;
    if (theReport == null) throw new ApplicationException("Invalid report type: " + typeOfDynamicReport.Name);

    // now set any parameters on the report
    if (ReportParameters.Count > 0)
    {
     // get the report list
     flag = "access_report_parms";
     List<Telerik.Reporting.ReportParameter> theParameters = theReport.ReportParameters.ToList();

     // build a dictionary
     Dictionary<string, Telerik.Reporting.ReportParameter> theDictionary = new Dictionary<string, Telerik.Reporting.ReportParameter>();
     foreach (Telerik.Reporting.ReportParameter parameter in theParameters)
     {
      theDictionary.Add(parameter.Name.ToUpper(), parameter);
     } //foreach

     // look up each item from input to the report itself
     flag = "iterate_source_parms";
     foreach (Telerik.Reporting.ReportParameter sourceParameter in ReportParameters)
     {
      // the specified source parameter must exist in the report
      string key = sourceParameter.Name.ToUpper();
      if (!theDictionary.Keys.Contains(key))
      {
       throw new ApplicationException(
        string.Format(
         "Source parameter {0} does not exist in report parameters",
         sourceParameter.Name
        )
       );
      } //if
      Telerik.Reporting.ReportParameter reportParameter = theDictionary[key];

      // do simple type coercion
      flag = "decode_parm_types";
      Type typeReport = GetTypeFromReportType(reportParameter.Type);
      Type typeSource = GetTypeFromReportType(sourceParameter.Type);

      // shortcut
      if (typeReport == typeSource)
      {
       // set value explicitly
       reportParameter.Value = sourceParameter.Value;
       continue;
      } //if

      // simple type coercion (exception on failure)
      flag = "convert_" + sourceParameter.Name;
      object oParameterValue = Abr.CodeLibrary.DataAccess.DataObject.DbObject(
       typeReport, sourceParameter.Value, false
      );
      reportParameter.Value = oParameterValue;
     } //foreach
    } //next

    // set the report
    Report = theReport;
   }
   catch (Exception ex)
   {
    LH.error("Problem at ", flag, ": ", ex);
    NotifyError("Report Problem: " + ex.Message);
   } //try
  } //loadReport

  /// <summary>
  /// The stored report for display within this viewer
  /// </summary>
  public Telerik.Reporting.IReportDocument Report
  {
   get { return _report; }
   set { _report = value; if (_pageIsLoaded) setReport(); }
  } //Report

  /// <summary>
  /// For control via the ASCX properties, allow a report name to be specified.
  /// This name should be the class name of the report in the ArchG2.Reporting
  /// module. This property uses reflection to load the report for display by the control.
  /// </summary>
  public string ReportName
  {
   get { return _reportName; }
   set { _prevReportName = _reportName; _reportName = value; }
  } //ReportName

  /// <summary>
  /// Return reference to the stored report parameter actual list.
  /// Useful to access from code (use ReportParametersString from ASCX).
  /// </summary>
  public Telerik.Reporting.ReportParameterCollection ReportParameters
  {
   get { return _reportParameters; }
  } //ReportParameters

  /// <summary>
  /// Pass in report parameters as a string; parsed with ; (semicolon)
  /// as delimiter. Use Name=Value;[Name=Value;...] format.
  /// </summary>
  public string ReportParametersString
  {
   get { return _reportParametersString; }
   set
   {
    string flag = "";
    try
    {
     // anything to do?
     flag = "validate_parms";
     _reportParametersString = value;
     _reportParameters.Clear();
     if (string.IsNullOrEmpty(_reportParametersString)) return;

     // parse the report parameters
     flag = "parse_parms";
     string[] parms = _reportParametersString.Split(';');
     if (parms.Length == 0) return;

     // parse each parameter
     flag = "iter_parms";
     foreach (string parm in parms)
     {
      // sanity
      if (string.IsNullOrEmpty(parm)) continue;

      // validate
      int idxEqual = parm.IndexOf('=');
      if (idxEqual <= 0)
      {
       throw new ApplicationException(
        string.Format("Parameter {0} should be in format Name=Value", parm)
       );
      } //if

      // construct the parm
      string parmName = parm.Substring(0, idxEqual);
      string parmValue = parm.Substring(idxEqual + 1);
      Telerik.Reporting.ReportParameter reportParm = new Telerik.Reporting.ReportParameter(
       parmName, Telerik.Reporting.ReportParameterType.String, parmValue
      );
      _reportParameters.Add(reportParm);
     } //foreach

     // if we have already loaded the page,
    }
    catch (Exception ex)
    {
     LH.error("Problem at ", flag, ": ", ex);
     NotifyError("Report Problem: " + ex.Message);
    } //try
   } //set
  } //ParametersString

  /// <summary>
  /// Handle export status
  /// </summary>
  /// <param name="e"></param>
  protected override void OnInit(EventArgs e)
  {
   // create controls
   base.OnInit(e);
  }

  /// <summary>
  /// Auto-generated
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  protected void Page_Load(object sender, EventArgs e)
  {
   // indicate Page_Load has fired
   _pageIsLoaded = true;

   // check to see if we need to do a one-time load
   if (IsFirstTime)
   {
    if (Report != null)
    {
     // user set report explicitly; use that
     setReport();
    }
    else if (!string.IsNullOrEmpty(ReportName))
    {
     // report name set via ASCX; use that
     loadReport();
    } //if

    // only do this once
    SetFirstTime(false);
   } //if

   // set the height every time from hidden variable
   try
   {
    Unit unitExplicitHeight = Unit.Parse(hdnExplicitHeight.Value);
    if (unitExplicitHeight != Unit.Empty && unitExplicitHeight.Value > 0)
    {
     // safety
     if (unitExplicitHeight.Value < 100)
     {
      unitExplicitHeight = Unit.Parse("100px");
     } //if
     Height = unitExplicitHeight;
    } //if
   }
   catch
   {
   } //try
  }

  /// <summary>
  /// Put in our own control height (page height)
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  protected void rptvw_Init(object sender, EventArgs e)
  {
   string flag = "";
   try
   {
    // find the toolbar
    flag = "locate_toolbar";
    Control ctlToolbar = rptvw.FindControl("ReportToolbar");
    if (ctlToolbar == null) throw new ApplicationException("No toolbar; new Telerik version?");

    // this is reverse engineered from telerik; might work
    flag = "create_controls";
    Table tblHeight = new Table();
    tblHeight.ID = "PageHeight";
    tblHeight.CssClass = "ReportToolbarGroup";
    Abr.CodeLibrary.Utils.Global.MergeCssStyleAttributes(tblHeight.Attributes, "float:left;");
    tblHeight.CellPadding = 0;
    tblHeight.CellSpacing = 0;

    TableRow rowHeight = new TableRow();
    rowHeight.ID = "row";

    TableCell cellHeight = new TableCell();
    cellHeight.ID = "cell";

    Label lblHeight = new Label();
    lblHeight.ID = "lblHeight";
    lblHeight.AssociatedControlID = "txtHeight";
    lblHeight.Text = "Height: ";

    _txtHeight = new TextBox();
    _txtHeight.ID = "txtHeight";
    _txtHeight.Width = Unit.Parse("5em");

    LinkButton btnResize = new LinkButton();
    btnResize.ID = "btnResize";
    btnResize.Text = "Resize";
    btnResize.Click += new EventHandler(btnResize_Click);

    flag = "add_controls";
    cellHeight.Controls.Add(lblHeight);
    cellHeight.Controls.Add(_txtHeight);
    cellHeight.Controls.Add(btnResize);
    rowHeight.Cells.Add(cellHeight);
    tblHeight.Rows.Add(rowHeight);
    ctlToolbar.Controls.Add(tblHeight);
   }
   catch (Exception ex)
   {
    LH.error("Problem at ", flag, ": ", ex);
    NotifyError("Report: " + ex.Message);
   } //try
  }

  /// <summary>
  /// Used to capture explicit resize
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  void btnResize_Click(object sender, EventArgs e)
  {
   hdnExplicitHeight.Value = _txtHeight.Text;
   Height = Unit.Parse(_txtHeight.Text);
  }
 } //TelerikReportViewer
} //namespace

 

 

 

 

 

 

shahzad
Top achievements
Rank 1
 answered on 29 Dec 2011
1 answer
111 views
Hi.
I'm having problem using the report guide because i can not find referenced EF (it's in another project).
I have two project, one with my EF data model, and another project with my reports.
I have made a reference of the EF project into my report project, byt when i run the report wizard, i can not add/find my model.
So how can this be done? How can i have separate project for my EF model and for my reports?

BR
Linus
Peter
Telerik team
 answered on 29 Dec 2011
0 answers
89 views
We have some telerik forms created in our application that you can display and then print on demand. The issue is the forms render  based on the default printer installed on the computer. For example, I have a generic HP printer attached to my computer, and the form displays correctly before printing. A co worker has a bar code printer installed as their default printer, and when they view the form, it breaks up the one page form to display in bar code sized windows. How do we change this so the intial display is a regular 8 1/2 x 11 display or PDF, regardless of printer installed? This form needs to be displayed in a proper manner on all client machines, but does not require printing on all machines.
Thanks
Ken
Top achievements
Rank 1
 asked on 28 Dec 2011
2 answers
88 views
When I get a server error in my silverlight viewer, I only see a blank in the report viewer.  On the asp.net report viewer I see the error just fine.  I'll get an out of memory error a lot, and I want to be able to see that, or pop up a rad window saying there was an out of memory error, please filter your data.  I don't see any events where I can catch the message.

Our clients want to print out 1000-5000 page reports, but my test server doesn't have much memory on it, so I expect to get a lot of errors during testing.
danparker276
Top achievements
Rank 2
 answered on 28 Dec 2011
3 answers
201 views
Hi Telerik team.

I have a problem whit my Page Header Section Report. It simple, print preview not match with report view. Details about the design and views of the report are the images attached.

Can you help us with is issue.
Giuliano Caetano.
Elian
Telerik team
 answered on 28 Dec 2011
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?