Evaluating Expressions in DocumentName

5 posts, 1 answers
  1. Sypher
    Sypher avatar
    79 posts
    Member since:
    Aug 2006

    Posted 08 Sep 2008 Link to this post

    I have a ReportViewer on a web page that is set up to view a specific report.   The report has a DocumentName of

    = "ReportName-" + Format("{0:yyyy-MM-dd}", Now())

    It returns something like ReportName-2008-09-08 when the report is exported.  If I do this on the page with the ReportViewer:

    Page.Title = ReportViewer1.Report.DocumentName;

    the page's title is set to the expression and not the expression after it is evaluated.  Is there any way to get the evaluated version of that expression in the page codebehind?  Is this a place where I should use a public user-defined function instead?  I'm new to playing with the
  2. Sypher
    Sypher avatar
    79 posts
    Member since:
    Aug 2006

    Posted 08 Sep 2008 Link to this post

    Ugh.  I have no idea how that got sent multiple times...  Please delete the other copies of this thread.
  3. DevCraft banner
  4. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 09 Sep 2008 Link to this post

    Hi sypher,

    This is not possible. The Report is evaluated and shown after the page has already loaded and the Report.DocumentName property has not been designed for such purposes - basically it just shows a suggested name for the saved document.
    Our advice would be to set the Page.Title separately in your web page, as it does not depend in any way of the report datasource and would be evaluated properly by the .NET.

    All the best,
    Steve
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Sypher
    Sypher avatar
    79 posts
    Member since:
    Aug 2006

    Posted 09 Sep 2008 Link to this post

    Yeah, I figured as much.  Just wanted to make sure.  My concern is that I would like to have one page with one ReportViewer that is used for a lot of different reports.  When I choose a report, I would like the page title to correspond to the currently chosen report.  I just thought it would be easiest to keep those page titles with the reports themselves instead of keeping a separate list. 

    I'm sure there's a good way to do this.  I may just wrap the Telerik Report object and add the functionality I need in the wrapper.
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 09 Sep 2008 Link to this post

    Hi sypher,

    Doing that might make you spent more time than just creating a list of all the reports (how much could that number be? >30?) and sync it with the title when changing the shown report.

    Sincerely yours,
    Steve
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
DevCraft banner