Ok, this is the code for ReportCatalogPart class:
public class ReportCatalogPart : CatalogPart
{
private ReportConfigurationReader _mrptReader;
private SQLConfigurationReader _msqlReader;
private string _mstrReportConfigurationFile;
private string _mstrSQLConfigurationFile;
public ReportCatalogPart()
{
if (ViewState["ReportConfigurationFile"] != null) _mstrReportConfigurationFile = (string)ViewState["ReportConfigurationFile"];
if (ViewState["SQLConfigurationFile"] != null) _mstrSQLConfigurationFile = (string)ViewState["SQLConfigurationFile"];
CreateConfiguration();
}
[
UrlProperty(),
DefaultValue(""),
Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(System.Drawing.Design.UITypeEditor)),
]
public string ReportConfigurationFile
{
get
{
return _mstrReportConfigurationFile;
}
set
{
_mstrReportConfigurationFile = value;
ViewState["ReportConfigurationFile"] = value;
}
}
[
UrlProperty(),
DefaultValue(""),
Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(System.Drawing.Design.UITypeEditor)),
]
public string SQLConfigurationFile
{
get
{
return _mstrSQLConfigurationFile;
}
set
{
_mstrSQLConfigurationFile = value;
ViewState["SQLConfigurationFile"] = value;
}
}
public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
{
CreateConfiguration();
if (_mrptReader != null)
{
return ReportLoader.GetReportDescriptions(_mrptReader);
}
return null;
}
public override WebPart GetWebPart(WebPartDescription description)
{
CreateConfiguration();
if (_msqlReader != null)
{
return ReportLoader.GetReportWebPart(this.Page, _mrptReader, _msqlReader, description.ID);
}
return null;
}
private void CreateConfiguration()
{
if (_mrptReader == null && _mstrReportConfigurationFile != "" && _mstrReportConfigurationFile != null) _mrptReader = new ReportConfigurationReader(this.Context.Server.MapPath(_mstrReportConfigurationFile));
if (_msqlReader == null && _mstrSQLConfigurationFile != "" && _mstrSQLConfigurationFile != null) _msqlReader = new SQLConfigurationReader(this.Context.Server.MapPath(_mstrSQLConfigurationFile));
}
}
Thanks,
Andrey.