Pro SQL Server 2012 Reporting Services

(sharon) #1
CHAPTER 9  RENDERING REPORTS FROM .NET APPLICATIONS

try
{
values[0] = new ParameterValue();
values[0].Label = "ServiceYear";
values[0].Name = "ServiceYear";
values[0].Value = "2009";


parametersSSRS = rs.GetItemParameters(report, historyID,
forRendering, values, credentials);


if (parametersSSRS != null)
{
foreach (ItemParameter rp in parametersSSRS)
{
this.SuspendLayout();
this.parameterPanel.SuspendLayout();
this.parameterPanel.SendToBack();


// now create a label for the combo box below
Label lbl = new Label();
lbl.Anchor = (System.Windows.Forms
.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left);
lbl.Location = new System.Drawing.Point(x, y);
lbl.Name = rp.Name;
lbl.Text = rp.Name;
lbl.Size = new System.Drawing.Size(150, 20);
this.parameterPanel.Controls.Add(lbl);
x = x + 150;


// now make a combo box and fill it
ComboBox a = new ComboBox();
a.Anchor = (System.Windows.Forms
.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
a.Location = new System.Drawing.Point(x, y);
a.Name = rp.Name;
a.Size = new System.Drawing.Size(200, 20);
x = 5;
y = y + 30;


this.parameterPanel.Controls.Add(a);
this.parameterPanel.ResumeLayout(false);
this.ResumeLayout(false);


if (rp.ValidValues != null)
{
//Build listitems
ArrayList aList = new ArrayList();
pvs = rp.ValidValues;
foreach (ValidValue pv in pvs)
{
aList.Add(new ComboItem

Free download pdf