Telerik Forums
Reporting Forum
4 answers
396 views
Hello All,

I wanted to post this so no one else has to go through what I went through trying to figure out how to dynamically change the connection string when using .trdx files as the urisource in the windows forms report viewer and having each customer with their own database being able to run the canned reports that we make for our software.

First, when you design the report, give the SQL Datasource a Name and check the box to save it in the configuration file (I did this from the Telerik Standalone Report Designer. This will not expose your connection information to end users and allow them to create alternative reports for your canned reports without letting them see the connection password.

Second, add a line into your [appname].exe.config file for the connection string and leave the connection string value BLANK. It should look something like this (put this right under <configSections> and I think the casing matters on <connectionStrings>:

<connectionStrings>
    <add name="Marketplace" providerName="System.Data.SqlClient" connectionString="" />
  </connectionStrings>

Next, if you have a connection string either encrypted (we encrypt our connection password only and read it into memory on login to our application and assign it to a global variable called ADOnet), you will want to set the named connectionstring in memory and have it refresh. In VB.Net, this can be done by using the following code:

Dim config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Dim connectionStringsSection = DirectCast(config.GetSection("connectionStrings"), ConnectionStringsSection)
connectionStringsSection.ConnectionStrings("Marketplace").ConnectionString = ADONet
config.Save()
ConfigurationManager.RefreshSection("connectionStrings")

In order to get ConfigurationManager to show up under System.Configuration you need to add System.Configuration explictily to your references in your project (just imports or using will not give you configuration manager)

Anyway, this will update your settings for your named connection in your reports in memory while in runtime.

Hope this helps you to not spend the 5 hours of research and testing it took me to find this solution.

Philip Carter
http://emanageone.com
Philip
Top achievements
Rank 1
 answered on 16 Aug 2014
1 answer
111 views
Hello,
Are there any examples or tutorials of dynamically binding data to a report? We are hosting the reports on a Web API and accessing them via an MVC app. For security reasons we do not want to use the Javascript-based ReportViewer on the MVC side to directly call the report on the API. Instead we would like to get an instance of that report, serialize it, and then dynamically bind the data to the report. How would we achieve this? 
Stef
Telerik team
 answered on 15 Aug 2014
2 answers
324 views
Hello, 
I am experiencing a problem trying to view a Telerik Report. The report is hosted on a Web Api project and is being accessed by an MVC project using the Javascript version of the ReportViewer. The ReportViewer is able to find the correct report but before it can be displayed I'm getting an error. The error is on this call to the Web Api project: http://localhost:xxxxxx/api/v1/Reports/clients/102235-d59f/instances/102235-d67f/documents/102235-8013/info. The error is "Specified cast is not valid". Here is the full stack trace:

Telerik.Reporting.Services.Engine.DocumentRenderException: Specified cast is not valid.
   at Telerik.Reporting.Services.Engine.Document.GetDocumentInfo()
   at Telerik.Reporting.Services.Engine.ReportInstance.<GetDocumentInfo>b__c(Document d)
   at Telerik.Reporting.Services.Engine.ReportInstance.ExecuteOnDocument[T](String documentID, Func`2 function)
   at Telerik.Reporting.Services.Engine.ReportInstance.GetDocumentInfo(String documentID)
   at Telerik.Reporting.Services.Engine.Client.<>c__DisplayClass1b.<GetDocumentInfo>b__1a(ReportInstance i)
   at Telerik.Reporting.Services.Engine.Client.ExecuteOnReportInstance[T](String instanceID, Func`2 function)
   at Telerik.Reporting.Services.Engine.Client.GetDocumentInfo(String instanceID, String documentID)
   at Telerik.Reporting.Services.Engine.ReportEngine.<>c__DisplayClass15.<GetDocumentInfo>b__14(Client client)
   at Telerik.Reporting.Services.Engine.ReportEngine.WithClient[T](String clientID, Func`2 func)
   at Telerik.Reporting.Services.Engine.ReportEngine.GetDocumentInfo(String clientID, String instanceID, String documentID)
   at Telerik.Reporting.Services.WebApi.ReportsControllerBase.GetDocumentInfo(String clientID, String instanceID, String documentID)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()

Like I said, it is not an issue of it not being able to find the report. In fact, even though this error is occurring, I can use the export menu of the ReportViewer to export the report to PDF, Excel, etc and it works fine. Can you please advise on this issue? 
Nasko
Telerik team
 answered on 15 Aug 2014
1 answer
123 views
Hello,

Is it possible to attach the parameter value as column name in SQLDATASOURCE?

In Sql datasource i used the below Stored procedure

declare @day as varchar
declare @Sql as varchar(3000)
set @day=1
Set @sql='select Cid,[' + @day + ']As Day1 from tbl_Amount_Track1'
Exec @Sql

Now i need to pass @day value from front end. Is it possible to pass multivalue parameter to @day from front end?


OR ELSE

Is it possible to display values of multivalue parameter straight away in report during runtime without using Sql datasource?
If so How to pass multivalue parameter to report using vb.net?

Thank you
Jayanthi
KS
Top achievements
Rank 1
 answered on 15 Aug 2014
2 answers
176 views
I've been searching the forums for how to implement report viewing in a truly seperated mvvm pattern.

From what I've found it seems no one has implemented it?

What I am hoping for is a Viewmodel that passes a different report (and/or a parameter) to the viewer according to the user's selections from the view selectedItem
Stef
Telerik team
 answered on 15 Aug 2014
1 answer
106 views
Hello all,

I'm currently having a problem where the collection items values are not in the same table. I'm using objectdatasource as my table data source.


Desired output:
No   Description
1      Value1
2      Value2


Current Output:

No  Description
1     Value1

No Description
1    Value2


Property : 

public class Test {

public List<Descriptions> myCollection
        {
            get
            {
                return myCollection;
            }
        }

}


public class Descriptions 
    {

public string Description
        {
            get { return description; }
            set
            {
                if (description == value) return;

                description = value;
              
            }
        }
}


This is how i set my data source:

Test t = new Test();

objectDataSource.DataSource = t.myCollection;
tabledatasource = objectDatasource;

Your help is much appreciated
Thx

























Stef
Telerik team
 answered on 14 Aug 2014
1 answer
124 views
Hello,

I am using Report Designer (standalone) and created a report (master-detail). The main report has a link to another report.
Is there anyway, to export all reports into one document where user can navigate the same way (something like a webpage), or by just having all report into one document (something like pdf or word)?

Thanks!
Stef
Telerik team
 answered on 14 Aug 2014
2 answers
92 views
I'm having a problem getting the data-attributes to work for a custom report menu. Following the example in the documentation I create a button with a data-command attribute, and add the data-target as instructed. I am still unable to trigger the functionality. Any help on this would be great. I have attempted this using several commands to test and thus far have been unsuccessful.

I have upgraded to the latest service pack ( Telerik Reporting Q2 2014 SP1 (8.1.14.804)) and according to the release notes, this version should expose the commands. I have attempted the above, as well as using the commands to get the instance and call the commands directly;

var sample = $('viewer').data('telerik_ReportViewer');
sample.commands.goToFirstPage().exec();

This too, has been unsuccessful. Do I need to be inside of a special container or such when calling the attributes?
Stef
Telerik team
 answered on 13 Aug 2014
1 answer
132 views
Silverlight 5 project

We upgraded from Q1 2014 to Q2 2014 and when we open up the .XAML in VS 2012 (loading designer...) that contains ReportViewerEx we get the following error:

Error 20 This feature requires service 'Microsoft.Windows.Design.Services.ValueTranslationService' to be present, but it could not be located.

Since this is a Telerik control (ReportViewerEx) needing this reference for the designer to be able to work, then there clearly is a problem with Q2 2014 ReportViewerEx for Silverlight project.  The Microsoft.Windows.Design.Services.ValueTranslationService is a .NET framework DLL ... it is NOT a Silverlight .DLL and hence will obviously not work in a Silverlight project.

See MSDN documentation here: http://msdn.microsoft.com/en-us/library/microsoft.windows.design.services.valuetranslationservice(v=vs.90).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

This is clearly not going to work, Telerik, you can NOT mix and match Silverlight and .NET framework DLLs, you are NOT permitted to use a .NET framework DLL in a Silverlight project so your control should NOT be referencing such a DLL in order to work.

We need a fix for this problem ASAP.

Rob




Stef
Telerik team
 answered on 13 Aug 2014
1 answer
542 views
Hi,
I want to develop a telerik report with both English, Arabic labels and outputs. The image is attached. Please a provide a solution.
Hinata
Top achievements
Rank 1
 answered on 13 Aug 2014
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?