http://localhost/Reportes es el administrador de nuestros reportes.
http://localhost/Servidor-Reportes Servidor de los reportes
Debemos tener claro el directorio donde generamos nuestros reportes en este caso seria:Nuestro directorio /Informes.
ReportViewer1.ServerReport.ReportPath = "/Informes/NuevoInforme"
Mira este ejemplo:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Reporting.WebForms;
using Microsoft.Reporting;
using System.Net.Security;
using Microsoft.Web.UI;
//Establece Referencia al proyecto UtilidadReportingServices
using UtilReportingServices;
namespace formularios{
///
/// Summary description for Informes.
///
public partial class MostrarInformes: System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
//Establecer la dirccion URL del Servidor de Reportes
ReportViewer1.ServerReport.ReportServerUrl =
new Uri("http://localhost/Servidor-Reportes");
//Establecer el Path donde se encuentran los reportes
ReportViewer1.ServerReport.ReportPath = "/Informes/NuevoInforme";
//Estabalcer las Credenciales
ReportViewerCredentials credencial = new ReportViewerCredentials("usuario", "password", "dominio");
ReportViewer1.ServerReport.ReportServerCredentials = credencial;
//Establaecer el Parametro Descontador para el informe
ReportParameter[] miParametro = new ReportParameter[1];
miParametro[0] = new ReportParameter("Variable");
ReportViewer1.ServerReport.SetParameters(miParametro);
//Propiedades del ReportViewer
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ShowFindControls = false;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
}
#endregion
}
}
No hay comentarios:
Publicar un comentario