|
Perpetuum Software is proud to announce the next release of Silverlight Viewer for Reporting Services 2.6 – a native Silverlight control for output of SQL Server Reporting Services reports in Silverlight applications. |
I’ve already described the features of this release in the previous post. In this post I will describe how to work with such new features of Silverlight Viewer for Reporting Services 2.6 as customization of parameters visibility and check of parameters values input by the user.
- So, how to customize parameter visibility.
In order to change parameter visibility, you need to subscribe to the ParameterVisibilityChanging event of the ReportViewer object in the parameters toolbar. You should change the visibility value for the parameter in the event handler.
For example:
<span> </span>(reportViewer_ParameterVisibilityChanging);
void reportViewer_ParameterVisibilityChanging(object sender, ParameterVisibilityChangingEventArgs e)
{
if (e.ParametersCollection != null)
{
foreach (var item in e.ParametersCollection)
{
if (item.Nullable)
item.Visibility = false;
}
}
}
On the picture below, you can see report generation without hiding the parameters:
And this picture shows report generation with checking if null value is possible:
- And the second feature is the ability to check parameters values
If you need to check parameters values entered by the user in the parameters toolbar, all you have to do is to subscribe to the ParametersProcessing event of the ReportViewer object.
For example:
You can check and change the report parameters values in the event handler. You can continue or cancel the document rendering if parameters values are entered incorrectly. In order the user could change the incorrect values you can set the ShowParametersPanel property of the ParametersProcessingEventArgs object equal to true. In this case the parameters toolbar won’t be hidden.
For example:
{
e.Collection.First(p => p.Name == "ReportParameter3").Value = "value from code";
}
if (e.Collection.Count(p => p.Name == "ReportParameter4") > 0)
{
int param4Value = int.Parse(e.Collection.First(p => p.Name == "ReportParameter4").Value);
if (!(param4Value > 3 && param4Value < 10))
{
e.CancelRender = true;
e.ShowParametersPanel = true;
ChildWindow1 frm = new ChildWindow1();
frm.Show();
}
}
In the example, you can see change of the value of the «ReportParameter3» parameter and check of the correctness of the value of the «ReportParameter4» parameter. If the «ReportParameter4» parameter value is correct, the document rendering will continue. If the «ReportParameter4» parameter value is incorrect, the parameters toolbar and the message about incorrect parameter value will be shown.
Entering parameters values:
Message about incorrect parameter value:
In this post, I described how to use only two of new Silverlight Viewer for Reporting Services 2.6 features. As you can see this is very simple. Besides the improvements in work with parameters, we added drillthrough action in charts, new abilities in work with localization and so on.
The precise description of Silverlight Viewer for Reporting Services 2.6 release you can see on Perpetuum Software site. And how to work with this new functionality you can know from our Knowledge Base.
Download Silverlight Viewer for Reporting Services 2.6…