I create a report but a i have this error
Error de servidor en la aplicación '/'.
Referencia a objeto no establecida como instancia de un objeto.Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.
Detalles de la excepción: System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
Error de código fuente:
Se ha generado una excepción no controlada durante la ejecución de la solicitud Web actual. La información sobre el origen y la ubicación de la excepción pueden identificarse utilizando la excepción del seguimiento de la pila siguiente.
Seguimiento de la pila:
[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]
Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action) +161
Telerik.Reporting.Processing.Table.MeasureDataItemContent(IMeasureContext context, SizeRF availableClientSize) +320
Telerik.Reporting.Processing.DataItem.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +149
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +289
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +141
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +135
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +121
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +134
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +65
Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +126
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +289
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +141
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +135
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +121
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +261
Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +123
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +289
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +141
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +135
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +121
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +261
Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +201
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +289
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +141
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +135
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +121
Telerik.Reporting.Processing.LayoutElement.MeasureElement(LayoutElement elementToMeasure, IMeasureContext context) +109
Telerik.Reporting.Html5Rendering.Html5ReportInteractive.MeasureReportCore(Report report, IMeasureContext measureContext) +51
Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureReport(Report report, Hashtable deviceInfo) +90
Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +419
Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +1372
Telerik.Reporting.Processing.ReportProcessor.RenderCore(String format, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +103
Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext) +122
Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +340
Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +173
Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext context, ICacheManager cacheManager) +74
Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) +276
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
the code is:
Report miReporte =
new
Report();
//Se asignan los parametros si es necesario
if
(param.Count > 0)
foreach
(ParametrosSP mid
in
param)
{
if
(mid._direccion)
{
miReporte.ReportParameters.Add(mid._nombre, mid._tipoReporte,
null
);
rrv_VistaReporte.ParametersAreaVisible =
true
;
}
}
//Se asigna el ancho al reporte
miReporte.Width = Telerik.Reporting.Drawing.Unit.Inch(4);
//se declara el uso de la seccion de detalle en el reporte
Telerik.Reporting.DetailSection ds_Seccion =
new
DetailSection();
//Se asigna un alto al detalle
ds_Seccion.Height = Telerik.Reporting.Drawing.Unit.Inch(0.2);
//Se declara una tabla para introducirla al detalle del reporte
Telerik.Reporting.Table tabla =
new
Telerik.Reporting.Table();
//Obtenemos los valores de filas y columnas
int
filas = ds.Tables[0].Rows.Count;
int
columnas = ds.Tables[0].Rows[0].ItemArray.Length;
//Se crea un arreglo de textbox que estaran colocados en las celdas de la tabla
Telerik.Reporting.TextBox[] titulos =
new
Telerik.Reporting.TextBox[columnas];
//Se crea un arreglo de grupos de tabla para empezar a asignar valores
Telerik.Reporting.TableGroup[] tg_Grupos =
new
TableGroup[columnas];
Telerik.Reporting.TableGroup tg_General =
new
TableGroup();
//Se obtienen los nombres de las columnas para el reporte
string
[] nombres = ConexionSQL.ParametrosSalidaObtenidos[0].ToString().Split(
','
);
//Se le otorga una posición a la tabla
tabla.Location =
new
Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(1.7000001668930054D), Telerik.Reporting.Drawing.Unit.Inch(1.1000000238418579D));
//Se le asigna un Nombre a la tabla
tabla.Name =
"TablaReporte"
;
//Se declaran los textbox del contenido
Telerik.Reporting.TextBox[] contenido =
new
Telerik.Reporting.TextBox[columnas];
//Se Agrega una nueva fila a la tabla
tabla.Body.Rows.Add(
new
Telerik.Reporting.TableBodyRow(Telerik.Reporting.Drawing.Unit.Inch(0.2916666567325592D)));
for
(j = 0; j < columnas; j++)
{
//Se inician cada uno de los valores que va a ir como titulos de las tablas
titulos[j] =
new
Telerik.Reporting.TextBox();
//Se le asigna un nombre al textbox
titulos[j].Name = nombres[j];
//Se le asigna un tamaño al textbox
titulos[j].Size =
new
Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(0.2916666567325592D));
//Se le asigna el valor al textbox
//en este caso como prueba es generico
titulos[j].Value = nombres[j];
//Se crean las columnas de la tabla
tabla.Body.Columns.Add(
new
Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(1.0000002384185791D)));
//Se inician cada uno de los grupos por columna
tg_Grupos[j] =
new
TableGroup();
//Se asigna un nombre a cada uno de los grupos
tg_Grupos[j].Name = nombres[j];
//Se asigna un textBox para recibir los datos
tg_Grupos[j].ReportItem = titulos[j];
//Se agregan los grupos a la tabla
tabla.ColumnGroups.Add(tg_Grupos[j]);
//Se agregan los textbox a la tabla
//tabla.Items.Add(titulos[j]);
//Se asigna un nuevo textbox a cada celda del arreglo
contenido[j] =
new
Telerik.Reporting.TextBox();
//Se le asigna un nombre al textbox
contenido[j].Name =
"tb_Celda"
+ j.ToString();
//Se le asigna un tamaño al textbox
contenido[j].Size =
new
Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(0.2916666567325592D));
//Se le asigna el valor al textbox
contenido[j].Value =
"=Fields.["
+ nombres[j] +
"]"
;
//Se asigna el textbox a cada celda de la tabla
tabla.Body.SetCellContent(i, j, contenido[j]);
//Se agrega el textbox a la tabla
tabla.Items.Add(contenido[j]);
}
tg_General.Groupings.Add(
new
Telerik.Reporting.Grouping(
null
));
tg_General.Name =
"detailTableGroup"
;
tabla.DataSource = ds.Tables[0];
tabla.RowGroups.Add(tg_General);
tabla.Size =
new
Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(3.0000002384185791D), Telerik.Reporting.Drawing.Unit.Inch(0.58333331346511841D));
//Se agrega la tabla a la seccion
ds_Seccion.Items.Add(tabla);
//Se agrega la seccion de detalle al reporte
miReporte.Items.Add(ds_Seccion);
//Se asigna el reporte al visualizador
rrv_VistaReporte.ReportSource = miReporte;
//Se refresca la vista
//rrv_VistaReporte.RefreshReport();