or
Hi there.
I have a multivalued parameter called of type int called "Person". With that in mind, I have 2 questions:
1. How do I pull the data out programmatically? Basically, I want to do something like this:
foreach (int personId in (List)this.ReportParameters["Person"].Value)
{
myList.Add(personId);
}
I can't quite figure out how to get at the collection and extract the values.
2. Along those same lines, how would I programmatically populate a multivalue parameter?
Thanks, Mike
| namespace Reporting |
| { |
| using System; |
| using System.ComponentModel; |
| using System.Drawing; |
| using System.Windows.Forms; |
| using Telerik.Reporting; |
| using Telerik.Reporting.Drawing; |
| using IRWLReporting_Rules; |
| /// <summary> |
| /// Summary description for Report1. |
| /// </summary> |
| public partial class ActivityRegistrationReport : Telerik.Reporting.Report |
| { |
| public ActivityRegistrationReport() |
| { |
| /// <summary> |
| /// Required for telerik Reporting designer support |
| /// </summary> |
| InitializeComponent(); |
| try |
| { |
| this.ReportParameters["ActivityId"].UI.AvailableValues.DataSource = new Reporting_Rules().GetActivityDataForReportParamDropdown(); |
| } |
| catch (Exception ex) |
| { |
| throw ex; |
| } |
| } |
| private void ActivityRegistrationReport_NeedDataSource(object sender, EventArgs e) |
| { |
| Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender; |
| report.DataSource = new Reporting_Rules().GetActivityRegistrantsForActivityReport(Convert.ToInt32(report.Parameters["ActivityId"])); |
| } |
| } |
| } |
| private void detail_ItemDataBinding(object sender, EventArgs e) |
| { |
| Log.Debug("detail_ItemDataBinding"); |
| DetailSection section = (DetailSection) sender; |
| MyObject c = section.DataObject.RawData as MyObject ; |
| tblHistory.DataSource = c.History; |
| } |
| Telerik.Reporting.ReportItemBase[] reportitmfooter = new ReportItemBase[ds.Tables[0].Columns.Count]; |
| for (int i = 0; i < ds.Tables[0].Columns.Count; i++) |
| { |
| //Fill the Group footer for show sum or count |
| Telerik.Reporting.TextBox txtGroupFooter = new Telerik.Reporting.TextBox(); |
| txtGroupFooter.Value = "=count([" + headcolumnname + "])"; |
| txtGroupFooter.Name = "Sum" + headcolumnname; |
| //textBoxDetails.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(xaxis, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(yaxis, Telerik.Reporting.Drawing.UnitType.Inch)); |
| textBoxDetails.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Cm)); |
| reportitmfooter[i] = txtGroupFooter; |
| } |
| //group footer |
| Telerik.Reporting.GroupFooterSection groupFootersection = new GroupFooterSection(); |
| groupFootersection.Height = new Telerik.Reporting.Drawing.Unit(0.2, Telerik.Reporting.Drawing.UnitType.Inch); |
| groupFootersection.Style.BackgroundColor = System.Drawing.Color.Blue; |
| groupFootersection.KeepTogether = true; |
| groupFootersection.Visible = true; |
| groupFootersection.Name = "rptGroupFooter"; |
| groupFootersection.Items.AddRange(reportitmfooter); |
| report.Items.Add(groupFootersection); |


| public Report5() |
| { |
| InitializeComponent(); |
| SqlConnection sqlConnection1 = new SqlConnection(); |
| SqlCommand sqlSelectCommand1 = new SqlCommand(); |
| SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter(); |
| sqlConnection1.ConnectionString = myconnectionString; |
| sqlSelectCommand1.CommandText = mycommand; |
| sqlSelectCommand1.Connection = sqlConnection1; |
| sqlDataAdapter1.SelectCommand = sqlSelectCommand1; |
| this.table1.DataSource = sqlDataAdapter1; |
| } |
