For my application I need to build report parameters programmatically. I have tried to follow the examples available but I cannot get the parameters to display as a dropdown list of values. The parameter does show up in the viewer but as a textbox. Below is the code that I am using to build my parameter -
| Dim vals As New ArrayList |
| <fill vals with strings of option values> |
| Dim param As New ReportParameter |
| param.Type = ReportParameterType.String |
| param.UI.Visible = True |
| param.UI.MultiValue = True |
| param.Value = vals |
| Me.ReportParameters.Add(param) |
This is wrapped in a routine that is called when the report is bound to it's data source. When I try to call the routine from the report's constructor it results in a run-time error.
My questions are:
1. How do I get my options to show up as a dropdown list?
2. When should this routine be called?
3. Is it possible to build it with a value/key pair rather than just a list of values?
----------------------------------------------------------------------------------------------------------------
Upon further investigation, either programmatic definition of parameters is not supported or the documentation is severely lacking because I have tried every example (there are just a few) that I can find and it either results in no parameter or a run-time error. For example, just trying to add a simple test parameter with the following code results in no parameter in the viewer:
| Public Sub New() |
| InitializeComponent() |
| ReportParameters.Add("Test", ReportParameterType.String, "test") |
| End Sub |
Thanks,
Dave
| private void MyTable_NeedDataSource(object sender, EventArgs e) |
| { |
| SqlCommand sqlSelectCommand = new SqlCommand |
| { |
| CommandText = "SP_MyStoredProc", |
| Connection = new SqlConnection {ConnectionString = ConnectionString}, |
| CommandType = CommandType.StoredProcedure |
| }; |
| sqlSelectCommand.Parameters.Add("@individualId", SqlDbType.Int); |
| sqlSelectCommand.Parameters["@individualId"].Value = txtIndividualId.Value; //This is incorrect |
| Telerik.Reporting.Processing.Table tbl = (Telerik.Reporting.Processing.Table)sender; |
| tbl.DataSource = new SqlDataAdapter { SelectCommand = sqlSelectCommand }; |
| } |
Hi,
I want to print the telerik report from command line instead of using the
Print icon provided on Reportviewer toolbar. Please let me know if it is possible to
print telerik report from command line.
Thank you,
Anita.
| foreach (string filterRow in showHide) |
| { |
| switch(filterRow) |
| { |
| case "10": |
| this.textBoxEventTotals.Visible = true; |
| this.subReportCommunityEventTotals.Visible = true; |
| this.subReportCommunityEventTotals.Report.Visible = true; |
| break; |
| case "20": |
| this.textBoxEventTotalsByDate.Visible = true; |
| this.subReportCommunityEventTotalsByDate.Visible = true; |
| this.subReportCommunityEventTotalsByDate.Report.Visible = true; |
| break; |
| case "30": |
| this.textBoxTotalsByCommunity.Visible = true; |
| this.subReportCommunityEventTotalsByCommunity.Visible = true; |
| this.subReportCommunityEventTotalsByCommunity.Report.Visible = true; |
| break; |
| case "40": |
| this.textBoxCommunityAndDate.Visible = true; |
| this.subReportCommunityEventsByCommunityAndDate.Visible = true; |
| this.subReportCommunityEventsByCommunityAndDate.Report.Visible = true; |
| break; |
| case "50": |
| this.textBoxDetails.Visible = true; |
| this.subReportCommunityEventDetails.Visible = true; |
| this.subReportCommunityEventDetails.Report.Visible = true; |
| break; |
| } |
| } |
| } |