4 Answers, 1 is accepted
0
Hi Prashant,
Generally, we recommend to set values to report items (e.g. TextBoxes) in the report definition. You may use Expressions for this purpose. The data may come from a DataSource - check the available Data Source components. The value would be automatically calculated and resolved run-time by the Reporting engine.
You may also use Report Parameters in the expression.
If the value of a TextBox is supposed to come directly from the client (e.g. Report Viewer), you may set the value of the TextBox to the value of a Report Parameter (e.g. '= Parameters.ParameterName.Value') and pass the actual value from the user in the client ReportSource Parameters collection.
You may also pass objects from the client to the report via the UserIdentity.Context property. This dictionary has been introduced as means for passing values from the HttpContext to the report. Details and example on how to use it can be found in How to use information from HttpContext in Custom Report Resolver KB article.
If the above approaches are not suitable, you may use Custom Report Resolver where to instantiate the report, set/modify the value of the report item and return the modified report instance wrapped in an InstanceReportSource.
Regards,
Todor
Progress Telerik
Generally, we recommend to set values to report items (e.g. TextBoxes) in the report definition. You may use Expressions for this purpose. The data may come from a DataSource - check the available Data Source components. The value would be automatically calculated and resolved run-time by the Reporting engine.
You may also use Report Parameters in the expression.
If the value of a TextBox is supposed to come directly from the client (e.g. Report Viewer), you may set the value of the TextBox to the value of a Report Parameter (e.g. '= Parameters.ParameterName.Value') and pass the actual value from the user in the client ReportSource Parameters collection.
You may also pass objects from the client to the report via the UserIdentity.Context property. This dictionary has been introduced as means for passing values from the HttpContext to the report. Details and example on how to use it can be found in How to use information from HttpContext in Custom Report Resolver KB article.
If the above approaches are not suitable, you may use Custom Report Resolver where to instantiate the report, set/modify the value of the report item and return the modified report instance wrapped in an InstanceReportSource.
Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Marcel
Top achievements
Rank 1
answered on 23 Apr 2019, 12:10 PM
How to access the UserIdentity.Context in the report for example in an expression?
UserIdentity.Context["SomeKey"] doesn't work.
0
Hello Marcel,
You may pass the UserIdentity.Context and the Key to a custom user function that would return the Value of the Key, e.g. like :
The user function may generally look like :
The report designers do not support the type Dictionary, so it is not possible to use an Expression like '=UserIdentity.Context["SomeKey"]' directly in the report definition.
Regards,
Todor
Progress Telerik
You may pass the UserIdentity.Context and the Key to a custom user function that would return the Value of the Key, e.g. like :
= Namespace.GetFromContext(UserIdentity.Context, key)
The user function may generally look like :
public
static
object
GetFromContext(Dictionary<
string
,
object
> context,
string
key)
{
object
value = context[key]
;
return
value;
}
The report designers do not support the type Dictionary, so it is not possible to use an Expression like '=UserIdentity.Context["SomeKey"]' directly in the report definition.
Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Marcel
Top achievements
Rank 1
answered on 09 May 2019, 05:22 AM
Thx @Todor for your reply