Hi,
I have a subroutine in my report that adds parameters to my sqldatasource:
I want to call this subroutine from the webpage that I use to create a PDF from the report. (using the sample code from this website)
As you can see this is a generic function that only requires a Telerik report parameter.
So, in my code, I declare the report like this:
However, this way I can't access my function 'AddDataSourceParameter'.
It only works if I declare it like this:
But this way I no longer have a generic report type to use in my ExportToPDF function.
Is there another way to do this?
(I'm not looking at another way to bind my parameters, but another way to access this sub. This is just an example)
Thanks,
CJ
I have a subroutine in my report that adds parameters to my sqldatasource:
Public
Class
SalesReport
Inherits
Telerik.Reporting.Report
Public
Sub
New
()
InitializeComponent()
End
Sub
Public
Sub
AddDataSourceParameter(
ByVal
sParameterNaam
As
String
,
ByVal
tDBType
As
System.Data.DbType,
ByVal
oValue
As
Object
)
Me
.SqlDataSource1.Parameters.Add(sParameterNaam, tDBType, oValue)
End
Sub
End
Class
I want to call this subroutine from the webpage that I use to create a PDF from the report. (using the sample code from this website)
Sub
ExportToBrowser(
ByVal
reportToExport
As
Telerik.Reporting.Report)
Dim
reportProcessor
As
New
ReportProcessor()
Dim
result
As
RenderingResult = reportProcessor.RenderReport(
"PDF"
, reportToExport,
Nothing
)
Dim
fileName
As
String
= result.DocumentName +
".pdf"
Response.Clear()
Response.ContentType = result.MimeType
Response.Cache.SetCacheability(HttpCacheability.
Private
)
Response.Expires = -1
Response.Buffer =
True
Response.AddHeader(
"Content-Disposition"
,
String
.Format(
"{0};FileName="
"{1}"
""
,
"attachment"
, fileName))
Response.BinaryWrite(result.DocumentBytes)
Response.
End
()
End
Sub
So, in my code, I declare the report like this:
Dim
report
As
Telerik.Reporting.Report =
New
ReportLib.SalesReport
It only works if I declare it like this:
Dim
report
As
ReportLib.SalesReport =
New
ReportLib.SalesReport
Is there another way to do this?
(I'm not looking at another way to bind my parameters, but another way to access this sub. This is just an example)
Thanks,
CJ