
<%
@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%
@ Register Assembly="Telerik.ReportViewer.WebForms, Version=4.0.10.310, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<title></title>
<style type="text/css">
form#form1, div#content
{
height: 100%;
}
</style>
</
head>
<
body>
<form id="form1" runat="server">
<script type="text/javascript">
//Put your Java Script code here.
</script>
<div id="content">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:VenueWest2007ConnectionString %>"
SelectCommand="SELECT dbo.vw_promotion_code.*
FROM dbo.vw_promotion_code">
<SelectParameters>
</SelectParameters>
</asp:SqlDataSource>
<telerik:ReportViewer ID="ReportViewer1" runat="server" Height="100%" Width="100%">
</telerik:ReportViewer>
</div>
</form>
</
body>
</
html>
Default.vb:
Imports
Telerik.Web.UI
Imports
vwReport2010
Imports
System.IO
Partial
Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim report1 As New test0318
'report1.DataSource = SqlDataSource1
ReportViewer1.Report = report1
End If
End Sub
End
Class
<style type="text/css">
div#MainContent_repView1_ReportViewer, #MainContent_repView1_ReportViewer_ReportArea_ReportArea, #MainContent_repView1_ReportViewer_ReportTable, #MainContent_repView1_ReportViewerReportFrame
{
height: 1200px;
}
</style>
UPDATE [HR_Employees]SET EmployeeSignature = (SELECT BulkColumn FROM OPENROWSET( Bulk 'C:\Signatures\Justin.bmp', SINGLE_BLOB)AS BLOB) WHERE EmployeeNumber = '99999'public ActionResult PrintPoReport(string id) { var irs = new InstanceReportSource(); irs.ReportDocument = new LogisticsReports.PoHeader(); irs.Parameters.Add(new Parameter("PoID", id)); Telerik.Reporting.Processing.ReportProcessor rp = new Telerik.Reporting.Processing.ReportProcessor(); Telerik.Reporting.Processing.RenderingResult result = rp.RenderReport("PDF", irs, null); byte[] contents = result.DocumentBytes; return File(contents, "application/pdf", "P0 #" + id + ".pdf"); }The watermark shows fine in the designer using Print Preview.
During runtime there is a crash.
<Watermarks>
<TextWatermark Text="= Elixir.App.Reports.DataSources.LoadIsPreliminary(Parameters.site.Value, Parameters.load_key.Value).ToString()" Color="Red" Orientation="Diagonal" Position="Front" Opacity="0.1" PrintOnFirstPage="True" PrintOnLastPage="True">
<Font Name="helvetica" Size="60pt" />
</TextWatermark>
</Watermarks>using Telerik.Reporting.Expressions;
namespace Elixir.App.Reports.DataSources
{
class BolFunctions: Telerik.Reporting.Report
{
/// <summary>
/// Is this load preliminary?
///
/// User function for Telerik reports
/// </summary>
/// <param name="site"></param>
/// <param name="loadKey"></param>
/// <returns></returns>
[Function(IsVisible = true, Category = "WatermarkTest", Description = "Testing", Namespace = "Elixir.App.Reports.DataSources", Name="LoadIsPreliminary")]
public static string LoadIsPreliminary(string site, string loadKey)
{
// Would actually prefer that this function return a bool
// and let the report output a non-blank watermark if true, otherwise no watermark.
// Would like to have another boolean function as well, LoadIsSpecialCase2, etc.
return "This is another test";
}
}
}
preferred watermark:<Watermarks>
<TextWatermark Text="= IIf(Elixir.App.Reports.DataSources.BolReportInfo.LoadIsPreliminary(Parameters.site.Value, Parameters.load_key.Value), "PRELIMINARY", 
 IIf(Elixir.App.Reports.DataSources.BolReportInfo.LoadIsCancelled(Parameters.site.Value, Parameters.load_key.Value), "CANCELLED", ""))" Orientation="Diagonal" Position="Front" Opacity="0.1" PrintOnFirstPage="True" PrintOnLastPage="True">
<Font Name="helvetica" Size="60pt" />
</TextWatermark>
</Watermarks>