Hello (again) -
On my report's page header, I have a text box and when the report is generated, the text value needs to change depending on the item from a drop-down list on the web page.
I have tried a few ways to get this to work but I have not been succesful. Does anyone know of a way to do this with the report control on a web page? I can save the drop-down list selected value as a Session variable if necessary.
Thanks
- will
On my report's page header, I have a text box and when the report is generated, the text value needs to change depending on the item from a drop-down list on the web page.
I have tried a few ways to get this to work but I have not been succesful. Does anyone know of a way to do this with the report control on a web page? I can save the drop-down list selected value as a Session variable if necessary.
Thanks
- will
4 Answers, 1 is accepted
0

Rossen Hristov
Top achievements
Rank 1
answered on 06 Sep 2007, 01:05 PM
Hi Will,
You can add a public property to your report that will expose the value of the TextBox so that it can be set from outside. For example, if the TextBox is called textBox1:
Then after you create your report and before you show it, you can set this property depending on your session variable:
Hope this helps.
Rossen
Telerik Reporting Team
You can add a public property to your report that will expose the value of the TextBox so that it can be set from outside. For example, if the TextBox is called textBox1:
public class MyReport : Report |
{ |
//Code omitted |
public string MyDynamicValue |
{ |
set |
{ |
this.textBox1.Value = value; |
} |
} |
//Code omitted |
} |
Then after you create your report and before you show it, you can set this property depending on your session variable:
protected void Page_Load(object sender, EventArgs e) |
{ |
Report report = new MyReport(); |
report.MyDynamicValue = mySessionVariable; |
this.ReportViewer1.Report = report; |
} |
Hope this helps.
Rossen
Telerik Reporting Team
0

Will
Top achievements
Rank 1
answered on 06 Sep 2007, 02:32 PM
This will solve my problem. I cannot believe I forgot how the other report parameters (for the stored proc) were created and exposed to the calling page.
Thanks as always for the great help.
Thanks as always for the great help.
0
Hi Will,
I have attached a sample solution that covers the case you are asking for. This solution contains three projects:
Greetings,
Ivan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I have attached a sample solution that covers the case you are asking for. This solution contains three projects:
- WebSite - this web site project keeps track of selected comboBox items and reloads the report. The report was reinitialized according to the selection of comboBox (see Default.aspx.cs file for code implementation);
- Report1 - this class library project contains a specific report. This report has a ReportType property which you could use to change the textBox item in report's header and to change report's DataSource too (see ReportType property and ReportCS1_NeedDataSource method in Report1CS.cs file);
- Windows app - this complementary project shows how to deal with this case in a windows forms app.
Greetings,
Ivan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Will
Top achievements
Rank 1
answered on 07 Sep 2007, 01:57 PM
Thanks Ivan. This will help too.