Telerik Forums
Reporting Forum
1 answer
83 views
Hi,

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
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:
Dim report As Telerik.Reporting.Report = New ReportLib.SalesReport
However, this way I can't access my function 'AddDataSourceParameter'.
It only works if I declare it like this:
Dim report As ReportLib.SalesReport = New ReportLib.SalesReport
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
Squall
Top achievements
Rank 1
 answered on 08 Apr 2011
5 answers
803 views
Dear Telerik,

I'm using the CrossTab report for the first time, and have a very simple (seemingly) report. The rows of the report contain a list of equipment numbers, the columns contain a list of dates rotated 90 degrees, and the detail cell contains a simple integer value (like 30, 60, 90).

The report could produce 200-300 rows of equipment numbers, AND 100-200 dates across the top. (This report is "tall" and "wide")

For the life of me, I can't figure out how to get the "horizontal" data to break to new pages (and thereby repeating the equipment numbers, with the next set of dates at the top). It simply vaporizes off the side of the report. I have set the page size, and have tried the "KeepTogether" properties of all controls, etc.

The report is producing the proper layout...data..etc. I just need it to break new pages when it grows too wide for the page, and repeat the eqiupment numbers on the new page.

I have read the report tutorial PDF, and have scoured the website for an answer...I must be missing something simple...

Thanks!

Jason Perry
Hrisi
Telerik team
 answered on 08 Apr 2011
1 answer
221 views
Hello Team,

I am using Telerik Reporting Version=5.0.11.316 in my MVC application, it is working fine while in development but when i publish/host the application on same machine report does not work, i have followed all the steps and referenced required DLL but still it's not working, please let me know if i have missed any thing while publishing the application. I have attached a screen shot, please have a look.



Regards
Mridul Sharma



  
Mridul
Top achievements
Rank 1
 answered on 08 Apr 2011
0 answers
76 views
Why items keep repeating themselves in the report?
Ahmed
Top achievements
Rank 1
 asked on 07 Apr 2011
4 answers
165 views
Hello, i want to print report pragmaticaly from silverlight... i already have code:

 private void OnPrintButtonClick(object sender, RoutedEventArgs e)
        {
            PrintDocument pd = new PrintDocument();
            Collection<Canvas> pagesList = new Collection<Canvas>();
            Model.PageRoot.UpdateLayout();
            pagesList.Add((Canvas)Model.PageRoot);
            while (Model.PageNumber < Model.PageCount)
            {
                Model.MoveToNextPageCommand.Execute(null);
                Model.PageRoot.UpdateLayout();
                pagesList.Add((Canvas)Model.PageRoot);
            }
        
            int index = 0;
            pd.PrintPage += (s, arg) =>
            {
                if (index >= pagesList.Count)
                {
                    arg.HasMorePages = false;
                    return;
                }
                arg.PageVisual = pagesList.ElementAt(index);
                arg.HasMorePages = true;
                index++;
            };
            pd.Print("");
        }

but when i use  Model.MoveToNextPageCommand.Execute(null); PageRoot is not updated and i have the same page each time... can you help me? how can i go through pages and collect data in images array for print them next? what should i do to update pageroot?
danparker276
Top achievements
Rank 2
 answered on 07 Apr 2011
1 answer
123 views
I'm looking for an example of how to bind a char to a generic list of first names and last names. My list looks like the following:
public class Names
{
    public string FirstName;
    public string LastName;
}

After gathering my data I create a list of Names
List<Names>ABunchOfNames = new List<Names>();

My list is populated, I see all of the names in the list...

I then set the datasource of the table to the List:
myTable.Datasource = ABunchOfNames;

When I look at the datasource during debug, I can see that my list is in there...  When I let the report finish I get the following errors:
"An error has occurred while processing Textbox 'textbox19': The expression contains object 'FirstName' that is not defined in the current context.

I get the same thing for LastName...

I am using Q2 2009 Telerik reporting due to the hoops I have to jump through to make the slightest of changes of architecture...  Any help? 

Thanks.
Lonnie
Top achievements
Rank 2
 answered on 07 Apr 2011
3 answers
169 views
Hi,

Is there a way that I can hide a column of a certain table when exporting to pdf?

Im using Q1 with silverlightviewer, so I need the report to be generated while I click the pdf in silverlight viewer.


Regards
Bill
Steve
Telerik team
 answered on 07 Apr 2011
7 answers
713 views
When i deploy my app on web server (app was running ok on my local pc) telerik reports are not open
it gives me 3 error 'Unexpected token < ' , ReportViewer is undefined in  chrome
and ReportViewer is undefined error in IE
I view following thread to solve this probelm
Telerik.ReportViewer missing in IIS - works with dev-webserver

and try to resolve but still the problem persist
here is my web.config file
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
  <configSections> 
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
        </sectionGroup> 
      </sectionGroup> 
    </sectionGroup> 
  </configSections> 
   
  
   
  <system.web> 
    <!--  
            Set compilation debug="true" to insert debugging  
            symbols into the compiled page. Because this  
            affects performance, set this value to true only  
            during development. 
        --> 
    <compilation debug="true" defaultLanguage="c#"
      <assemblies> 
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
        <!--<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>--> 
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
 
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> 
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
        <add assembly="Telerik.Web.UI, Version=2009.3.1208.35, Culture=neutral, PublicKeyToken=121FAE78165BA3D4"/> 
       <!-- <add assembly="Telerik.Reporting, Version=3.2.9.1211, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/> 
        <add assembly="Telerik.ReportViewer.WebForms, Version=3.2.9.1211, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"></add> 
        --> 
        <add assembly="Telerik.Reporting, Version=4.0.10.317, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/> 
        <add assembly="Telerik.ReportViewer.WebForms, Version=4.0.10.317, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"></add> 
      </assemblies> 
 
    </compilation> 
    <!-- 
            The <authentication> section enables configuration  
            of the security authentication mode used by  
            ASP.NET to identify an incoming user.  
        --> 
    <authentication mode="Windows"/> 
    <sessionState mode="InProc" cookieless="false" timeout="60"/> 
    <!-- AUTHORIZATION 
            This section sets the authorization policies of the application. You can allow or deny access to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous (unauthenticated) users. 
        --> 
    <authorization> 
      <allow users="*"/> 
    </authorization> 
 
    <!-- 
            The <customErrors> section enables configuration  
            of what to do if/when an unhandled error occurs  
            during the execution of a request. Specifically,  
            it enables developers to configure html error pages  
            to be displayed in place of a error stack trace. 
 
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"
            <error statusCode="403" redirect="NoAccess.htm" /> 
            <error statusCode="404" redirect="FileNotFound.htm" /> 
        </customErrors> 
        --> 
    <customErrors mode="Off"/> 
    <pages> 
      <controls> 
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      </controls> 
    </pages> 
    <httpHandlers> 
      <remove verb="*" path="*.asmx"/> 
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
      <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false"/> 
      <add path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=4.0.10.317, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" validate="true" /> 
    </httpHandlers> 
    <httpModules> 
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" /> 
    </httpModules> 
  </system.web> 
  <system.codedom> 
    <compilers> 
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        <providerOption name="CompilerVersion" value="v3.5"/> 
        <providerOption name="WarnAsError" value="false"/> 
      </compiler> 
    </compilers> 
  </system.codedom> 
  <!--  
        The system.webServer section is required for running ASP.NET AJAX under Internet 
        Information Services 7.0.  It is not necessary for previous version of IIS. 
    --> 
  <system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/> 
    <modules> 
      <remove name="ScriptModule"/> 
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" /> 
    </modules> 
    <handlers> 
      <remove name="WebServiceHandlerFactory-Integrated"/> 
      <remove name="ScriptHandlerFactory"/> 
      <remove name="ScriptHandlerFactoryAppServices"/> 
      <remove name="ScriptResource"/> 
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI"/> 
      <add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=3.2.9.1211, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" preCondition="integratedMode,runtimeVersionv2.0" /> 
    </handlers> 
    <defaultDocument> 
      <files> 
        <clear/> 
        <add value="Default.htm"/> 
        <add value="default.aspx"/> 
        <add value="Default.asp"/> 
        <add value="index.htm"/> 
        <add value="index.html"/> 
        <add value="iisstart.htm"/> 
      </files> 
    </defaultDocument> 
  </system.webServer> 
  <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
      <dependentAssembly> 
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> 
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
      </dependentAssembly> 
      <dependentAssembly> 
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> 
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
      </dependentAssembly> 
    </assemblyBinding> 
  </runtime> 
</configuration> 

Mridul
Top achievements
Rank 1
 answered on 07 Apr 2011
1 answer
132 views
I'm wondering the best way to do this.  Also I'm using silverlight report viewer so I can't give the reports the dataset.

I basically want to make the selectCommand dynamic like
Select a,b,c from tableA where d=1
if @paramter1="Z" then add " and z=1 "  to the query
Select a,b,c from tableA where d=1 and z=1

I could do this by stored procedure, but I'd rather not add another stored procedure to my database.
I could use filters, but I'm going to get too many rows back.

Can I make another SQL DataSource and bind it to my Report based on a parameter I send in?
Can I use iff() in the selectCommand ?

Using a stored procedure will work ok for me.  Just wondering if there's another way.
danparker276
Top achievements
Rank 2
 answered on 06 Apr 2011
1 answer
84 views
Hello,

I have a couple of pictureboxes in my report.  I programmatically bind an image file to a picturebox object using the following code.

pictureBox_Specimen1.Value = System.Drawing.

Image.FromFile(sketchpath.Path);

 


Before the report is created/displayed I can modify the image located at sketchpath.path.  After I open the report and then close it, I am no longer able to perform any IO on the image until I restart my application.

How do I have the report release the image resource?

In the report dispose event I have set the picturebox value to null and this does not help.

Any help would be greatly appreciated!
Shawn
Top achievements
Rank 1
 answered on 06 Apr 2011
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?