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

Displaying Report Parameters

2 Answers 240 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
turntablistlp
Top achievements
Rank 1
turntablistlp asked on 12 May 2009, 12:02 AM
I'm trying to display the user-selected value of a parameter (with automatic UI) in my report, but I'm not sure how to correctly access the value.  In this report, I have a DateTime parameter which I would to display in the report header.

The best idea I could come up with was to use:
this.ReportParameters["DateStart"].Value.ToString() 

However, that gives me the original value I set ("=DateTime.Now").  It makes sense that it just displays the string entered as the default value, but I'm trying to get the actual input from the user.  So if the user selected 5/11/2009 as the date, I'm looking to get a DateTime object back that represents 5/11/2009 so I can format it and display it in my report header.

How can I do this?

Thanks.



2 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 12 May 2009, 10:43 AM
Hello turntablistlp,

You can do this either directly in the expression editor by casting to Date and using one of the formatting methods of the DateTime object i.e.:

= CDate(Parameters.DateStart).ToShortDateString()

or by creating an user function, that would format the date accordingly in your favorite language (C#, VB.NET) and set it to the textbox like so:

= FormatDateParam(Parameters.DateStart)

If you need to do this programmaticaly, you should use the processing report parameters instead (more info on processing vs definition).

Regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
turntablistlp
Top achievements
Rank 1
answered on 13 May 2009, 11:42 PM
Thank you, Parameters.DateStart was what I was looking for.  I was trying to do it programmatically, as I forgot it could be set from within the designer.  Using "Parameters.DateStart" in the designer, along with a user function accomplished what I was trying to do.

Thanks!
Tags
General Discussions
Asked by
turntablistlp
Top achievements
Rank 1
Answers by
Steve
Telerik team
turntablistlp
Top achievements
Rank 1
Share this question
or