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

Using parameter value to set Textbox value

2 Answers 862 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 09 Dec 2010, 09:02 PM
We have a base report that includes several text boxes, such as report title, date range, etc. These boxes are set as protected in the base report, so that they can be modified in the derived instance.

In the derived reports we want to set the text values; the literal values (ie the report name) are no problem, but I can't understand how to set texbox values based on parameter values. For example, we're passing a start date and end date, and we'd like to display those dates on the report. How can I access the parameter values in code-behind? I've tried statements like;

Public Sub New()
    txtReportTitle.Value = "Active Employees by Location"
    txtSubtitle.Value = Me.ReportParameters("CompanyName").Value
    InitializeComponent()
End Sub

...but this throws an invocation error. The assignment statements work properly when I use a literal value.

Help?

2 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 14 Dec 2010, 07:21 PM
Hi Derek,

The Report Parameters have definition and processing counterpart. We have noticed that you are accessing the report parameters definition value that is actually returning the report parameter's default value. In order to access the processing counterpart of the report parameters you will have to move your code to an event or as the Report Designer does set the textbox value to an expression 

this.textBox3.Value = "= Parameters.Parameter1.Value";

Regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Derek
Top achievements
Rank 1
answered on 14 Dec 2010, 07:42 PM
Actually I think we were going about this in the wrong way. We ended up moving the parameters into the base class (since they're common), and handling it that way. I wasn't sure whether we could expose or access the parameter values in the derived page, but discovered we could; as long as there were only reportparameter definitions in one place.

Thanks for the help.
Tags
General Discussions
Asked by
Derek
Top achievements
Rank 1
Answers by
Peter
Telerik team
Derek
Top achievements
Rank 1
Share this question
or