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

Evaluating Expressions in DocumentName

4 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sypher
Top achievements
Rank 1
Sypher asked on 08 Sep 2008, 11:05 PM
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

4 Answers, 1 is accepted

Sort by
0
Sypher
Top achievements
Rank 1
answered on 08 Sep 2008, 11:09 PM
Ugh.  I have no idea how that got sent multiple times...  Please delete the other copies of this thread.
0
Accepted
Steve
Telerik team
answered on 09 Sep 2008, 09:24 AM
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.
0
Sypher
Top achievements
Rank 1
answered on 09 Sep 2008, 02:48 PM
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.
0
Steve
Telerik team
answered on 09 Sep 2008, 03:01 PM
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.
Tags
General Discussions
Asked by
Sypher
Top achievements
Rank 1
Answers by
Sypher
Top achievements
Rank 1
Steve
Telerik team
Share this question
or