Using parameter value to set Textbox value

3 posts, 1 answers
  1. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 09 Dec 2010 Link to this post

    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. Answer
    Peter
    Admin
    Peter avatar
    1611 posts

    Posted 14 Dec 2010 Link to this post

    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.
  3. DevCraft banner
  4. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 14 Dec 2010 Link to this post

    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.
Back to Top