5 Answers, 1 is accepted
The Report Parameter area provides out of the box UI support for the parameters that covers 98% of the user cases and for that reason it is not customizable. In order to achieve your requirement, you should create custom UI for the parameters (for example using our RadComboBox control) and hook it up to the parameters via the Reporting API. Another option to limit the available choices is to make the parameter a Cascading Parameter.
Best wishes,Peter
the Telerik team
Using version Q2 2011
I have a StatusId and Status that is in an SQL table.
The information is almost : 1 Saved
2 Approved
3 Denied.
and the list is much bigger.
So when the user selects all , right now I get Status: Saved, Approved, Denied
I would want to display Status: All
and if the user selected only 2 and 3.
I still want to see Status: Approved, Denied.
I am using a user function to convert array to string for the Parmeters.StatusID.Label.
Here is the Report Parameter definition:
reportParameter2.AvailableValues.DataSource =
this.StatusDataSource;
reportParameter2.AvailableValues.DisplayMember = "= Fields.Status";
reportParameter2.AvailableValues.Sortings.AddRange(new Telerik.Reporting.Data.Sorting[] {
new Telerik.Reporting.Data.Sorting("=Fields.Status", Telerik.Reporting.Data.SortDirection.Asc)});
reportParameter2.AvailableValues.ValueMember = "= Fields.StatusID";
reportParameter2.MultiValue = true;
reportParameter2.Name = "StatusID";
reportParameter2.Text = "Status";
reportParameter2.Type = Telerik.Reporting.
ReportParameterType.Integer;
reportParameter2.Value = "9999";
// this initial value is taken into consideration in stored procedure to select all Status
reportParameter2.Visible =true;
Here is the textbox I am trying to display the selected values in :
// StatustextBox
//
this.StatustextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(1.100078821182251D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.42057722806930542D, Telerik.Reporting.Drawing.UnitType.Inch));
this.StatustextBox.Name = "StatustextBox";
this.StatustextBox.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.1999211311340332D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType.Inch));
this.StatustextBox.Value = "= StringFunctions.ArrayToString(Parameters.StatusID.Label)";
// This is a user function I added to convert from array of objects to string.
Is there a way I can do that?
As explained in our previous post, the report parameters cover most of the use cases, still your scenario is more specific and in order to achieve your requirement you should create custom UI for the parameters (for example using our RadComboBox control) and hook it up to the parameters via the Reporting API. This way when the user selects 'All' you can provide only the string 'All' to the report parameter.
Greetings,Peter
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
I'm also having this specific requirement to display only the string 'All' to the report parameter when the user selects 'All' in multivalue parameter.
Can you please give some example to create the custom UI for the such requirement as I'm very new to the telerik? and we have got this defect from production.
Regards,
Tarun
To add a multivalued parameter you will have to:
- Create a report - How To: Create a Report (Visual Studio)
- Add a report parameter - Using Multivalue Parameters
- Display the report in a viewer, where my recommendation is to use the HTML5 Report Viewer
In general the idea to use custom UI is to have full control over the parameter's editors. For example you can use a CheckBoxList control and subscribe for its change events. On change of the selection in the control you need to pass the new values to the report, which can be done through the report source object wrapping the report.
If we assume you are using the ASP.NET ReportViewer the parameters update will look as follows:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
var typeReportSource =
new
Telerik.Reporting.TypeReportSource();
typeReportSource.TypeName =
"Telerik.Reporting.Examples.CSharp.ListBoundReport, CSharp.ReportLibrary"
;
ReportViewer1.ReportSource = typeReportSource;
}
}
protected
void
DropDownList1_SelectedIndexChanged(
object
sender, EventArgs e)
{
if
(ReportViewer1.ReportSource.Parameters.Contains(
"Parameter1"
)
ReportViewer1.ReportSource.Parameters[
"Parameter1"
].Value=
"new value"
;
else
ReportViewer1.ReportSource.Parameters.Add(
"Parameter1"
,
"initial value"
);
}
If you are using the HTML5 Report Viewer, please check the example in How To: Pass Values to Report Parameters.
When you use the HTML5 Report Viewer, you can also customize the report parameters editors loaded in the viewer's parameters area - How To: Create a Custom Parameter Editor. All default parameters editors are Kendo UI widgets loaded through the viewer's template files (CSS,JS and HTML).
I hope the provided information helps you.
Regards,
Stef
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.