Hi,
we are new on Telerik Reporting, basically in this moment we are testing the tool and try to decide if we replace SSRS. we are using the Telerik MVC Reportviewer for ASP.NET MVC (Reporting R3 2016) and we set a couple elements configuration in order to use this tool, everything looks good (apparently), but when the application host calls the ReportViewer and try to render the content, nothing happen, basically the report viewer control is showed but the content inside it not.
Here our configuration:
1. DAO Object:
[DataObject]
public class DIAS_FESTIVO : BASE
{
public int ID_FESTIVIDAD { get; set; }
public string EVENTO_FESTIVO { get; set; }
public string FECHA_FESTIVIDAD { get; set; }
public bool ES_DIA_HABIL { get; set; }
public DIAS_FESTIVO(string strConexion, string strNombreApp)
{
this.strConexion = strConexion;
this.strNombreApp = strNombreApp;
}
public DIAS_FESTIVO()
{
}
[DataObjectMethod(DataObjectMethodType.Select)]
public List<DIAS_FESTIVO> getListDIAS_FESTIVOS()
{
List<DIAS_FESTIVO> DIAS_FESTIVOS = new List<DIAS_FESTIVO>();
DataTable dt = new DataTable();
try
{
strConexion = "Data Source=XXXX;User ID=XXX;Password=YYYY;Unicode=True";
Database db = new Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase(strConexion);
OracleDbType cursor = OracleDbType.RefCursor;
DataSet oDataSet = db.ExecuteDataSet("MI_PKG.ObtenerDiasFestivos", cursor);
dt = oDataSet.Tables[0];
//On this point the data has been extracted, we have debugged this part and see the information, after the query is solved we convert the datatable into collection
DIAS_FESTIVOS = DataTableToList<DIAS_FESTIVO>(dt);
}
catch (Exception ex)
{
throw ex;
}
return DIAS_FESTIVOS;
}
}
2. We set a Custom Report Resolver class in order to handle the request to fill the report datasource, here is:
public class CustomReportResolver : Telerik.Reporting.Services.Engine.IReportResolver
{
public Telerik.Reporting.ReportSource Resolve(string reportId)
{
ObjectDataSource oDs = new ObjectDataSource();
oDs.DataSource = typeof(DIAS_FESTIVO); //Indicate the collection to use
oDs.DataMember = "getListDIAS_FESTIVOS"; //the method to extract the collection on the point #1
oDs.Name = "Report1.trdp"; //This is the name of the report, previously created on the Telerik Report designer
Report rpt = new Report();
rpt.DataSource = oDs;
rpt.Name = "Report1.trdp";
rpt.Visible = true;
return new Telerik.Reporting.InstanceReportSource { ReportDocument = rpt };
}
}
3. On View cshtml (partial view)
@model Telerik.Reporting.ReportSource
@using NEW
<style>
#reportViewer1 {
position: relative;
width: auto;
height: 500px;
font-family: Verdana, Arial;
}
</style>
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl(Url.Content("/api/reports"))
.ReportSource("1")
.ViewMode(ViewMode.Interactive)
.ScaleMode(ScaleMode.Specific)
.Scale(1.0)
.PersistSession(false)
.PrintMode(PrintMode.AutoSelect)
)
4. WebConfig file in application host has been set,
<configSections>
<section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere" />
</configSections>
<Telerik.Reporting>
<assemblyReferences>
<add name="DAO" version="1.0.0.1"/>
</assemblyReferences>
</Telerik.Reporting>
DAO is the project class c# you see in the point #1
Please see the attached image: ReportViewer_Loaded.png in order to see the result when the page has been loaded. I am pretty sure that the code into DAO object is executed when the application is running because we debugged that part, but I suspect the problem is when we try to bind the template dataset into report with the datasource (dataset included) passed as parameter (I mean the collection object as you see in the point #1) because when we test the template report (Report1.trdp) from Telerik Report design the data appear, in that moment the connection is directly on oracle database.
Please your help,
Many Thanks,