Is there a way to trigger a custom action when a user clicks on a record? Basically I have a report view showing several records. When the user clicks on a row, I'd like to execute code based on the row's ID that they clicked. Seems straight forward but I don't see anything in the documentation other than bookmarks and URLs.
Telerik Reporting Q1 2015
VS 2013
VB.net
Is it possible to have a legend based on series data points?
Peter
I have a program that gets some data from a database and prints a report to a printer on schedule. It runs unattended so there can never be user input. I have it printing to the default printer, but I'd like to print to a defined network printer (\\servername\printername).
How can I code that?
Is there any way to export my report as JPEG?
I'm used to designing my report by Telerik ASP.NET MVC report .
Hope to get some helps.Hi;
I would like to know how to build a report with a customized graph. It is specifically for a customization report but the question is general in the aspect of how to customize a graph.
An attached bitmap has been added witha graph output I'd like to achieve.
Peter
Hello,
with the latest production release.
Error message:
Object reference not set to an instance of an object.
I have a site that allows users to upload images to the report. The users can upload as many images as they want and the images get appended to the report.
The report viewer initially contains a report and the users images are appended at the button of the report. The way I append the images: I have created a one page report that has an image in the middle of the report. I iterate through all the image paths and add a new report for each image.
Here is an example of when the report processes the error. When a user adds 1 image and renders the report the report view looks great but once they add more images and try to render the report the report view crashes.
Below is the Error and Stack Trace:
URL: /api/Reports/clients/160626-95db/instances/160630-aeac/documents/161216-3e80161216-c106/info
"message":"",
"exceptionMessage":"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index",
"exceptionType":"Telerik.Reporting.Services.Engine.DocumentRenderException",
"stackTrace":" at Telerik.Reporting.Services.Engine.Document.GetDocumentInfo()\r\n at Telerik.Reporting.Services.Engine.ReportEngine.GetDocumentInfo(String clientID, String instanceID, String documentID)\r\n at Telerik.Reporting.Services.WebApi.ReportsControllerBase.GetDocumentInfo(String clientID, String instanceID, String documentID)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"
Here is the report:
namespace LT.Services.Reporting.EFV.Reports.Reports.ScannedImage
{
partial class rptScannedImage
{
#region Component Designer generated code
/// <summary>
/// Required method for telerik Reporting designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Telerik.Reporting.Group group1 = new Telerik.Reporting.Group();
Telerik.Reporting.ReportParameter reportParameter1 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.ReportParameter reportParameter2 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.ReportParameter reportParameter3 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.ReportParameter reportParameter4 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.ReportParameter reportParameter5 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.ReportParameter reportParameter6 = new Telerik.Reporting.ReportParameter();
Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
Telerik.Reporting.Drawing.StyleRule styleRule2 = new Telerik.Reporting.Drawing.StyleRule();
Telerik.Reporting.Drawing.StyleRule styleRule3 = new Telerik.Reporting.Drawing.StyleRule();
Telerik.Reporting.Drawing.StyleRule styleRule4 = new Telerik.Reporting.Drawing.StyleRule();
this.groupFooterSection = new Telerik.Reporting.GroupFooterSection();
this.groupHeaderSection = new Telerik.Reporting.GroupHeaderSection();
this.detail = new Telerik.Reporting.DetailSection();
this.pictureBox1 = new Telerik.Reporting.PictureBox();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// groupFooterSection
//
this.groupFooterSection.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699D);
this.groupFooterSection.Name = "groupFooterSection";
this.groupFooterSection.Style.Visible = false;
//
// groupHeaderSection
//
this.groupHeaderSection.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699D);
this.groupHeaderSection.Name = "groupHeaderSection";
this.groupHeaderSection.Style.Visible = false;
//
// detail
//
this.detail.Height = Telerik.Reporting.Drawing.Unit.Inch(1.0000008344650269D);
this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.pictureBox1});
this.detail.Name = "detail";
this.detail.PageBreak = Telerik.Reporting.PageBreak.After;
//
// pictureBox1
//
this.pictureBox1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(3.9418537198798731E-05D), Telerik.Reporting.Drawing.Unit.Inch(0D));
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(1.0000003576278687D), Telerik.Reporting.Drawing.Unit.Inch(1D));
this.pictureBox1.Sizing = Telerik.Reporting.Drawing.ImageSizeMode.AutoSize;
this.pictureBox1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
//
// rptScannedImage
//
group1.GroupFooter = this.groupFooterSection;
group1.GroupHeader = this.groupHeaderSection;
group1.Name = "group";
this.Groups.AddRange(new Telerik.Reporting.Group[] {
group1});
this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
this.groupHeaderSection,
this.groupFooterSection,
this.detail});
this.Name = "rptScannedImage";
this.PageSettings.Margins = new Telerik.Reporting.Drawing.MarginsU(Telerik.Reporting.Drawing.Unit.Inch(0D), Telerik.Reporting.Drawing.Unit.Inch(0D), Telerik.Reporting.Drawing.Unit.Inch(0D), Telerik.Reporting.Drawing.Unit.Inch(0D));
this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Custom;
this.PageSettings.PaperSize = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(8.5D), Telerik.Reporting.Drawing.Unit.Inch(11D));
reportParameter1.Name = "PageNumber";
reportParameter1.Type = Telerik.Reporting.ReportParameterType.Integer;
reportParameter1.Value = "1";
reportParameter2.Name = "ImageToAdd";
reportParameter2.Value = "D:\\KDrive\\LT001\\LT001001\\001000003.tif";
reportParameter3.Name = "ImageExists";
reportParameter3.Type = Telerik.Reporting.ReportParameterType.Boolean;
reportParameter3.Value = "= True";
reportParameter4.Name = "RegistrationNumber";
reportParameter4.Value = "000000000";
reportParameter5.Name = "IsEmbeddedResource";
reportParameter5.Value = "= False";
reportParameter6.Name = "FileResourceName";
reportParameter6.Value = "LT.Services.Reporting.EFV.Reports.Contents.Images.eSubmission_CoverPage.jpg";
this.ReportParameters.Add(reportParameter1);
this.ReportParameters.Add(reportParameter2);
this.ReportParameters.Add(reportParameter3);
this.ReportParameters.Add(reportParameter4);
this.ReportParameters.Add(reportParameter5);
this.ReportParameters.Add(reportParameter6);
this.Style.BackgroundColor = System.Drawing.Color.White;
styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
new Telerik.Reporting.Drawing.StyleSelector("Title")});
styleRule1.Style.Color = System.Drawing.Color.Black;
styleRule1.Style.Font.Bold = true;
styleRule1.Style.Font.Italic = false;
styleRule1.Style.Font.Name = "Tahoma";
styleRule1.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(18D);
styleRule1.Style.Font.Strikeout = false;
styleRule1.Style.Font.Underline = false;
styleRule2.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
new Telerik.Reporting.Drawing.StyleSelector("Caption")});
styleRule2.Style.Color = System.Drawing.Color.Black;
styleRule2.Style.Font.Name = "Tahoma";
styleRule2.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(10D);
styleRule2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
styleRule3.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
new Telerik.Reporting.Drawing.StyleSelector("Data")});
styleRule3.Style.Font.Name = "Tahoma";
styleRule3.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(9D);
styleRule3.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
styleRule4.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
new Telerik.Reporting.Drawing.StyleSelector("PageInfo")});
styleRule4.Style.Font.Name = "Tahoma";
styleRule4.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(8D);
styleRule4.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {
styleRule1,
styleRule2,
styleRule3,
styleRule4});
this.Width = Telerik.Reporting.Drawing.Unit.Inch(1.0000393390655518D);
this.ItemDataBinding += new System.EventHandler(this.rptScannedImage_ItemDataBinding);
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
#endregion
private Telerik.Reporting.DetailSection detail;
private Telerik.Reporting.GroupHeaderSection groupHeaderSection;
private Telerik.Reporting.GroupFooterSection groupFooterSection;
private Telerik.Reporting.PictureBox pictureBox1;
}
}
Here is the location I add the image to the report
public partial class rptScannedImage : Telerik.Reporting.Report
{
private static readonly CacheHelper _cacheHelper = CacheHelper.Instance;
private Object thisLock = new Object();
public rptScannedImage()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
private void rptScannedImage_ItemDataBinding(object sender, EventArgs e)
{
lock (thisLock)
{
bool imageExists = (bool)this.ReportParameters["ImageExists"].Value;
int pageNumber = (int)this.ReportParameters["PageNumber"].Value;
string imageFile = (string)this.ReportParameters["ImageToAdd"].Value;
bool isEmbeddedResource = (bool)this.ReportParameters["IsEmbeddedResource"].Value;
string fileResourceName = (string)this.ReportParameters["FileResourceName"].Value;
if (!imageExists)
{
var txtNotAvailable = new Telerik.Reporting.TextBox();
txtNotAvailable.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.5D), Telerik.Reporting.Drawing.Unit.Inch(2.5D));
txtNotAvailable.Name = "txtNotAvailable";
txtNotAvailable.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(7.5D), Telerik.Reporting.Drawing.Unit.Inch(5.5));
txtNotAvailable.Style.Font.Name = "Times New Roman";
txtNotAvailable.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(72D);
txtNotAvailable.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
txtNotAvailable.Value = "Dummy Registered Document Image for " + (string)this.ReportParameters["RegistrationNumber"].Value;
this.detail.Items.Add(txtNotAvailable);
}
else
{
Image image = null;
// if it's not an embedded resourece
if (!isEmbeddedResource)
{
// we need to clone the image for thread safety
image = ReportDataMethod.GetImage(imageFile);
}
else
{
image = Reporting.EFV.Reports.ReportDataMethod.GetImageFromResource(fileResourceName);
}
double width = image.Width / image.HorizontalResolution;
double height = image.Height / image.VerticalResolution;
SizeU size = new SizeU(Unit.Inch(width), Unit.Inch(height));
Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
rpt.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Custom;
rpt.PageSettings.PaperSize = size;
pictureBox1.MimeType = "image/png";
pictureBox1.Value = image;
}
}
}
Here is the way I append the images in the resolver
// Add File Attachment to report
// Attach image files as pages
// Gets the paths
var pngImagePaths = ReportDataMethod.GetFilePaths(eFormID);
if (pngImagePaths != null)
{
var pageCountID = 1;
foreach (var imagePath in pngImagePaths)
{
// Add cover page (Eventually we will add this to all E-Forms
// Add scanned file
// note that setting filePath or File Resource Name to null will
// cause the preview to crash on reload
PDFToImageParameters fileParams = new PDFToImageParameters()
{
FilePath = imagePath,
FileResourceName = "",
ImageExists = true,
IsEmbeddedResource = false,
PageCount = pageCountID
};
var fileReport = UpdateScannedImageReportWithParams(eFormID, pageCountID == 1 ? "File Attachment" : String.Empty, pageCountID++, fileParams);
book.Reports.Add(fileReport);
}
}
Any help would be appreciated.
Thanks!
Hi,
I'm getting error - Value cannot be null. Parameter name: instance, after I upgraded my solution to the current telerik reports verson. Can you please let me know how I can fix this issue.
Please see the attached file for more information.
Thanks.
I am trying to change report definition dynamically but unable to bind datasource. Could you please help me in binding the datasource dynamically. I amusing LinqtoSQL as datasource.
On click of a button, I am calling the constructor of my report and getting the report document and setting it to InstantReportSource's report document.
I am serializing the report document to XML file and making modifying the report definition.
After deserializing, how to bind the datasource before inputting the report to report viewer.
Thanks
private
void
button6_Click(
object
sender, RoutedEventArgs e)
{
try
{
ReportViewerWindow rvw =
new
ReportViewerWindow();
Telerik.Reporting.InstanceReportSource instanceReportSource =
new
Telerik.Reporting.InstanceReportSource();
instanceReportSource.Parameters.Add(
"ParamDivisionId"
,
null
);
instanceReportSource.Parameters.Add(
"ParamStartDate"
,
new
DateTime(2014, 1, 1));
instanceReportSource.Parameters.Add(
"ParamEndDate"
,
new
DateTime(2014, 2, 1).AddMinutes(-1));
instanceReportSource.ReportDocument =
new
DispatchAnywhere3.Reports.Report1(_user, _repository, _adminRepo);
using
(System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(
"C:/Temp/XML/ReportInside.xml"
))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
xmlSerializer.Serialize(xmlWriter, instanceReportSource.ReportDocument);
}
using
(System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(
"C:/Temp/XML/ReportInsideSecond.xml"
))
{
XmlDocument document =
new
XmlDocument();
document.Load(
"C:/Temp/XML/ReportInside.xml"
);
XmlNodeList nodes = document.ChildNodes;
foreach
(XmlNode node
in
nodes)
{
if
(node.Name ==
"Report"
)
{
XmlNodeList nodes1 = node.ChildNodes;
foreach
(XmlNode node2
in
nodes1)
{
if
(node2.Name ==
"Style"
)
{
node2.Attributes[
"BackgroundColor"
].Value =
"Red"
;
}
}
}
}
document.Save(xmlWriter);
}
Telerik.Reporting.Report report =
null
;
using
(System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(
"C:/Temp/XML/ReportInsideSecond.xml"
))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
report = xmlSerializer.Deserialize(xmlReader)
as
Telerik.Reporting.Report ;
}
rvw.ReportViewer1.ReportSource =
new
InstanceReportSource { ReportDocument = report };
rvw.ReportViewer1.RefreshReport();
rvw.Show();
}
catch
(Exception ex)
{
MessageBox.Show(ex.ToString(),
"error"
, MessageBoxButton.OK, MessageBoxImage.Error);
}
}
Hello,
I am evaluating a trial version of the Standalone Report Designer and have two reports I want to link via Drillthrough.
I believe I have followed the correct procedures to select the "interactive" field and set up the corresponding next steps:
Edit Action > Navigate To Report > Select Report Source > URL or File
Both of my reports are published to our telerik server in the same folder / category. However, when I key the URL in the source box, add proper parameters, and preview, I am receiving the following message:
"Unable to get report parameters.
An error has occurred.
'https://telerik.justfab.net/Report/View/LMS_DEV/Department_Overview_Report' report cannot be found."
This is a valid URL for the report I am trying to link to, but assuming from the error message there must be some other way to reference the URL for an existing report that already resides on our server. I tried adding .trdx extension with no success.
Please let me know the proper URL format to use when setting up simple Drillthrough connection between two reports residing on the same server.
Thank you!