This is a migrated thread and some comments may be shown as answers.

Textbox display value from second datasource?

2 Answers 367 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Karen
Top achievements
Rank 1
Karen asked on 02 Jul 2013, 10:50 PM
I have created a report which is displaying data fine using OpenAccessDataSource to retrieve from my database Model.

In the page header I have a text box which should display a string value retrieved using a database query. How can I achieve this? I have looked at adding a second OpenAccessDataSource to the report to run the query but I don't think it is possible using this method. I'm quite new to the ORM concept so apologies if there is an obvious answer.

2 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 04 Jul 2013, 03:48 PM
You have to use another data item, but you can't add it to the page header section. So it seems the only way around it is to retrieve all of the required data at once or set the textbox property from the code behind with some custom data retrieval method (without the datasource components)
0
Karen
Top achievements
Rank 1
answered on 10 Jul 2013, 09:21 AM
I solved this in the end, by doing the following:

Creating a Functions.cs class and writing my own custom method to retrieve from the Open Data Access ORM and return a string value.
In the constructor of my report I added a binding to the textbox to call my custom method, passing in report parameters:

//Add new binding to txtName
                Telerik.Reporting.Binding bind1 = new Telerik.Reporting.Binding();
                bind1.Path = "Value";
                bind1.Expression = "=Functions.GetName(Parameters.connstr.Value, Parameters.parm1.Value)";
                txtName.Bindings.Add(bind1);
Tags
General Discussions
Asked by
Karen
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Karen
Top achievements
Rank 1
Share this question
or