Groups | Blog | Home
all groups > sql server reporting services > april 2005 >

sql server reporting services : Creating custom controls



Christopher Ireland
4/14/2005 1:55:23 PM
Hi all,

Using SQL Server 2000, Visual Studio .NET and the Report Project Wizard I've
nearly been able to create the kind of reports I like.

What I'd like to do now is to create a custom control and have it appear on
the Report Items toolbox along with the other report controls (Textbox,
Line, Table, Matrix etc.). I've tried creating an empty class:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using Microsoft.ReportDesigner;
using Microsoft.VisualStudio;
using Microsoft.ReportDesigner.Controls;
using Microsoft.ReportDesigner.Drawing;
using Microsoft.ReportDesigner.Serialization;
using System.Collections.Specialized;
using System.Xml.Serialization;
using Microsoft.ReportDesigner.Interop;

namespace ReportControl
{
public sealed class MyReportControl :
Microsoft.ReportDesigner.Controls.ReportControl
{

}
}

But when I build this as a dll and try and add it into the Report Items
toolbox I get the following error "File or assembly name
Microsoft.DataWarehouse, or one of its dependencies, was not found." I've
had a good look around on Google for any information on this error or
information on how to create a custom control for sql reporting services
without finding any. Could anybody please tell me if it is possible to
create custom controls for SQL 2000 reporting services? If so, is there any
information I can read on it?

I've read on:
http://msdn.microsoft.com/SQL/2005/2005Webcasts/ReportingServicesQandA.aspx
that:
"Sachin Asked: Can Reporting services be used to pull up reports from a C#
Windows Forms application?
Answered: Yes, this will be easily possible using the new Reporting Services
Winforms control which will ship in Visual Studio 2005."

Does this mean that I'll be able to use my own custom-created
System.Windows.Forms.Control within this new Reporting Services Winforms
control?

Many thanks for any head-ups on any of these questions,

Best Regards,

Christopher Ireland

Robert Bruckner [MSFT]
4/17/2005 6:07:18 PM
[quoted text, click to view]

No. The Winforms control can only be used to process and render existing
reports.

However, RS 2005 will add a so-called CustomReportItem. You can write
controls that implement certain interfaces and can then plug into report
designer and into report processing.


-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.



[quoted text, click to view]

Christopher Ireland
4/18/2005 12:00:00 AM
[quoted text, click to view]

Excellent. Thank you very much Robert, I'll look into it.

Best Regards,

Christopher Ireland.

Christopher Ireland
5/3/2005 12:00:00 AM
[quoted text, click to view]

Hi Robert,

It seems that when using the VS2005 Beta 2 (April 2005) along with the SQL
Server 2005 CTP (April 2005), CustomReportItem is sealed although there is a
ICustomReportItem interface.

I don't suppose you know where I could get an example of how to author a
custom control for SQL Server 2005 CTP (April 2005) ReportingServices using
VS2005 Beta 2 (April 2005), something along the lines of the SimpleControl
Sample for Windows Forms control?

Many thanks,

Chris.

Robert Bruckner [MSFT]
5/3/2005 10:21:35 AM
Well, since I worked on the design and the implementation, I certainly
should know how it works :). I want to add that CustomReportItem (CRI) in RS
2005 serves one main purpose: allow the integration of additional charting
capabilities. Hence, a CustomReportItem at this point can create an image
(with image maps) or a textbox, but not yet complex RDL report items at
processing time. The new data grouping RDL structure of the CustomReportItem
will also show how we will make table or matrix more powerful in future
releases.

The ICustomReportItem interface is the way to go. We are working on making
an interesting but yet not too complex sample publicly available that shows
how to implement a CRI design-time control (for report designer) and a CRI
processing control (for report server). We hope to have the sample and
documentation ready when we release RS 2005.
In the meantime you may want to look for a session at the upcoming TechEd
2005 conference presented by Andrew Bryan (Dundas Software). He will talk
about their work using the CRI approach (derived from complex prototypes we
have built) and how to build your own CRI controls:
http://www.msteched.com/content/sessions.aspx, Session BIN335 - "SQL Server
2005 Reporting Services Custom Report Items", Thursday, June 9, 5:00 PM -
6:15 PM.

--
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

Christopher Ireland
5/6/2005 12:00:00 AM
[quoted text, click to view]

Excellent! Many thanks for taking some time out to answer mine (and others)
questions!!

[quoted text, click to view]

That would be fantastic.

In the meantime I wonder if you're up for giving me a couple of tips in the
meantime <g>. My first objective is to get my custom component on the Report
Items ToolBox, so I created a simple dummy class that looks like this:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ReportingServices.Interfaces;
using Microsoft.ReportingServices.ReportProcessing;
using Microsoft.ReportingServices.ReportRendering;

namespace MyReportControl
{

public class MyNonDundasChart : ReportItem
{
public MyNonDundasChart() { }
}

public class MyReportControl : ICustomReportItem
{

private CustomReportItem customItem;

public ChangeType Process()
{
return ChangeType.None;
}

public Action Action
{
get { return new Action(); }
}

public CustomReportItem CustomItem
{
set { customItem = value;}
}

public ReportItem RenderItem
{
get { return new MyNonDundasChart(); }
}
}
}


However, when I try and add MyReportControl.dll into the Report Items
ToolBox, I get the following error:

There are no components in
"C:\Test\ReportProject1\MyReportControl\bin\Debug\MyReportControl.dll" that
can be placed on the toolbox.

Any chance of giving me a couple of "preview" pointers? Please <gg>?

[quoted text, click to view]

Maybe I'll look into getting the DVD set which may have this session on it;
Orlando, Florida is quite a way from Girona, Catalonia :-)

Best Regards,

Chris.

Robert Bruckner [MSFT]
5/11/2005 10:05:28 PM
Well, writing and integrating your design time control is not that simple.
Also registering it in the VS toolbox is not trivial at this point in VS
2005 Beta 2 and requires a set of manual steps (this will hopefully change
and be simplified with VS 2005 RTM). I would recommend you wait till we have
the sample ready.

Regarding the TechEd session - it seems to be pretty popular so far (based
on the registrations). Popular sessions are more likely to be recorded and
available on the post-conference DVD set.


-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button