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

Displaying ReportParameter DisplayMember in report

3 Answers 139 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Billy Rawls
Top achievements
Rank 1
Billy Rawls asked on 04 Aug 2010, 08:10 PM
Hello:

I can't seem to figure out how to display a ReportParameter's DisplayMember in a report. The ReportParameter is set via a SQL query.

I am generating the parameter using the code below:
reportParameter1.Name = "ClientId";
reportParameter1.Type = Telerik.Reporting.ReportParameterType.String;
reportParameter1.UI.AllowBlank = false;
reportParameter1.UI.Visible = true;
reportParameter1.UI.AvailableValues.DataSource = ds.Tables[1];
reportParameter1.UI.AvailableValues.DisplayMember = "name_display";
reportParameter1.UI.AvailableValues.ValueMember = "client_id";
this.ReportParameters.Add(reportParameter1);

"client_id" is an int, "name_display" is a string.

I have a textbox on the report that I am attempting to fill in the report's ItemDataBound event like this:
this.tbClientId.Value = string.Format("Client Id = {0}", reportParameter1.Value.ToString());

Obviously this only returns the "client_id" member. I need it to display the "name_display" member. How can I accomplish this?

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 06 Aug 2010, 03:59 PM
Hi Billy Rawls,

There are two approaches available to achieve the desired effect. In general you have to access the Processing Report Parameter's Label property as shown below:

  1. Set the TextBox value to an Expression:
    Client Id = {Parameters.ClientId.Label}

  2. Within an ItemDataBound event as shown in the following code snippet:

private void textBox2_ItemDataBound(object sender, EventArgs e)
{
    var procTextBox = (Telerik.Reporting.Processing.TextBox)sender;
    procTextBox.Value = procTextBox.Report.Parameters["ClientId"].Label;
}

Kind regards,
Peter
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Billy Rawls
Top achievements
Rank 1
answered on 06 Aug 2010, 04:09 PM
Label is not an available property for me when I follow approach 2.

In the mean time I have a different solution in place where I bind the value using in-line SQL. Thanks.
0
Steve
Telerik team
answered on 10 Aug 2010, 09:09 AM
Hi Billy Rawls,

We have introduced this functionality in the Q1 2010 release of Telerik Reporting. So if you want to use the suggested solution, you should upgrade to that or later version.

All the best,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Billy Rawls
Top achievements
Rank 1
Answers by
Peter
Telerik team
Billy Rawls
Top achievements
Rank 1
Steve
Telerik team
Share this question
or